Bagosep

Index Playlist

Jun 2nd, 2021
655
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. require '../vendor/autoload.php';
  2. use GuzzleHttp\Client;
  3.  
  4. $token = $_SESSION['token'];
  5.  
  6. $client = new Client([
  7.     'base_uri' => 'https://api.deezer.com',
  8. ]);
  9.  
  10. $response = $client->request('GET', '/user/me?access_token='.$token);
  11. $user = json_decode($response->getBody());
  12.  
  13. $user_id = $user->id;
  14.  
  15.  
  16. $client = new Client([
  17.     'base_uri' => 'https://api.deezer.com',
  18. ]);
  19.  
  20. $response = $client->request('GET', 'user/'.$user_id.'/playlists');
  21. $playlist = json_decode($response->getBody());
RAW Paste Data