Plan
Free
Country
Spain
Device
(PC)
Operating System
(Ubuntu 20.04)
My Question or Issue
I'm triyng to get the last played song using this code:
$ch3 = curl_init();
//Indicas el endpoint de la peticion
$endpoint = 'https://api.spotify.com/v1/me/player/recently-played?limit=2';
curl_setopt($ch3, CURLOPT_URL, $endpoint);
//Autorización y content type, estandar para utilizar access token
$authorization = "Authorization: Bearer " . $accesstoken;
curl_setopt($ch3, CURLOPT_HTTPHEADER, array('Content-Type: application/json', $authorization));
curl_setopt($ch3, CURLOPT_RETURNTRANSFER, 1);
//No se que hacen mucho pero funciona, si las quitas diria que no pasa nada
curl_setopt($ch3, CURLOPT_USERAGENT, "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:x.x.x) Gecko/20041107 Firefox/x.x");
curl_setopt($ch3, CURLOPT_SSL_VERIFYHOST, false);
curl_setopt($ch3, CURLOPT_SSL_VERIFYPEER, false);
//Resultado de la peticion
$resultat = json_decode(curl_exec($ch3),true);
echo "<pre>";
var_dump($resultat);
echo "</pre>";
The problem i'm facing is that the result is getting old played songs (4 or 5) days before. Is this a known issue ? How can i get the name of the really latest played song? Also to be included in the list of recently played songs do i have to listen all the song or only some seconds?
Any help would be apreciated
Thanks in advance