PHP code example of arunchaitanyajami / spotify-webapi-sdk
1. Go to this page and download the library: Download arunchaitanyajami/spotify-webapi-sdk library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
arunchaitanyajami / spotify-webapi-sdk example snippets
use SpotifyWebApiSdk\SpotifyWebApiSdk;
try {
$spotifyWebApi = new SpotifyWebApiSdk();
$token_obj = $spotifyWebApi->getAccessTokenWithCredentials(
'CLIENT_ID',
'CLIENT_SECRET'
);
echo $token_obj->access_token;
// echo $token_obj->token_type;
// echo $token_obj->expires_in;
} catch(\SpotifyWebAPI\SpotifyWebAPIException $e) {
echo $e->getMessage();
}