name); $albumartist = str_replace('"','\"',$albuminfo->artists[0]->name); $albumtracks = file_get_contents("https://api.spotify.com/v1/albums/" . $albumid . "/tracks"); $albumtracks = json_decode($albumtracks); $albumtracksarray = array(); foreach($albumtracks->items as $track){ array_push($albumtracksarray,$track->uri); } //print_r($albumtracksarray); }elseif(strpos($thelink,':playlist:') !== false){ $saving = "playlist"; $savelink = $thelink; $accesstoken = file_get_contents("https://ws.spotify.com/oauth/token?grant_type=none&client_id=warnermusic.se&client_secret=pJfyfUMz9K"); $accesstoken = json_decode($accesstoken); $accesstoken = $accesstoken->access_token; $playlistparts = explode(':',$thelink); $playlist_username = $playlistparts[2]; $playlistid = $playlistparts[4]; $playlisturl = "https://ws.spotify.com/2.0/user/" . $playlist_username . "/playlist/" . $playlistid . "?oauth_token=" . $accesstoken; $tracks = file_get_contents($playlisturl); $tracks = json_decode($tracks); $playlisttitle = $tracks->title; $playlistimage = $tracks->image; $playlistdescription = $tracks->annotation; }elseif(strpos($thelink,'spotify:track') !== false){ $tracklink = $thelink; $savelink = $thelink; $saving = "song"; $trackid = explode(':',$tracklink); $trackid = $trackid[2]; $trackinfo = file_get_contents('https://api.spotify.com/v1/tracks/' . $trackid); $trackinfo = json_decode($trackinfo); $albumname = str_replace('"','\"',$trackinfo->name); $albumartist = str_replace('"','\"',$trackinfo->artists[0]->name); $albumtracksarray = array(); array_push($albumtracksarray,$thelink); }else{ die("Please specify a Spotify link"); } ?> Spotify Save Button Subscribe Open