Search code examples
phpheaderembedspotify

How to test Spotify ID?


I wanna test if Spotify ID (converted from URI o URL) is OK. I did something similar with YouTube and it has been working. Unfortunatelly, this one not.

$headers = get_headers("https://open.spotify.com/embed/track/" . $value);
        if (!strpos($headers[0], '200')) {
            return false;
        }
        return true;

$value - SpotifyId


Solution

  • Thanks @biesior, I started using Laravel Spotify (from aerni). It hasn't everything, but there is enough functions for me. So I built search bar and there is displayed response from Spotify with everything: title, artist, preview, album etc. etc.