PHP code example of kirilkirkov / spotify-webapi-sdk
1. Go to this page and download the library: Download kirilkirkov/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/ */
kirilkirkov / spotify-webapi-sdk example snippets
use SpotifyWebAPI\SpotifyWebApi;
try {
$spotifyWebApi = new SpotifyWebApi();
$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();
}