Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- require '../vendor/autoload.php';
- use GuzzleHttp\Client;
- $token = $_SESSION['token'];
- $client = new Client([
- 'base_uri' => 'https://api.deezer.com',
- ]);
- $remove_id = str_replace('/id', '',$_POST['songs']);
- $songs = str_replace('https://www.deezer.com/track/','',$remove_id);
- if($_POST["songs"])
- {
- $response = $client->request('POST', 'playlist/'.$_POST['id'].'/tracks?access_token='.$token.'&songs='.$songs);
- $track = json_decode($response->getBody());
- if(!empty($track)){
- session_start();
- $_SESSION['msg-success'] = "Data track berhasil ditambahkan!";
- header("location: index.php?id=".$_POST['id']);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement