Spotify API GET curl with auth using php - is this code good?
There's not much you can do wrong here. It works. I don't want to go into details of how to handle Spotify's API, but I would like to comment on your code.
One thing I noticed is that, if there's an error, you call curl_close() twice. That looks like a bug.
You're using curl two times, and in quite a different way. The first time you set individual options with curl_setopt(), the second time you combine all options and call curl_setopt_array(). Your code would be more consistent if you used the same method both times.
Better still, why not make a simple function to do the curl call for you? Something like this:
function callSpotifyApi($options) 
{
    $curl  = curl_init();
    curl_setopt_array($curl, $options); 
    $json  = curl_exec($curl);
    $error = curl_error($curl);
    curl_close($curl);
    if ($error) {
        return ['error'   =&gt; TRUE,
                'message' =&gt; $error];
    }
    $data  = json_decode($json);
    if (is_null($data)) {
        return ['error'   =&gt; TRUE,
                'message' =&gt; json_last_error_msg()];
    }
    return $data; 
}

This function combines all the things that are common between the two curl calls, and therefore saves you writing code twice, and the reader reading it twice. This function also checks if the returned json code was valid and tells you what was wrong. You would normally use json_last_error() to detect json errors, but if a Spotify call returns null then there's surely an error.
Given the above function, the first curl call would now become:
$headers  = ['Authorization: Basic '.base64_encode($client_id.':'.$client_secret)];
$url      = 'https://accounts.spotify.com/api/token';
$options  = [CURLOPT_URL            =&gt; $url,
             CURLOPT_RETURNTRANSFER =&gt; TRUE,
             CURLOPT_POST           =&gt; TRUE,
             CURLOPT_POSTFIELDS     =&gt; 'grant_type=client_credentials',
             CURLOPT_HTTPHEADER     =&gt; $headers];
$credentials = callSpotifyApi($options); 
$token = $credentials-&gt;access_token;

I haven't tested this code, so there might be errors. The second call will now be very similar:
$headers  = ['Content-Type: application/json',
             'Authorization: Bearer '.$token];
$url      = 'https://api.spotify.com/v1/audio-features/'.$spotify_track;
$options  = [CURLOPT_URL            =&gt; $url,
             CURLOPT_RETURNTRANSFER =&gt; TRUE,
             CURLOPT_FOLLOWLOCATION =&gt; TRUE,
             CURLOPT_ENCODING       =&gt; '',
             CURLOPT_MAXREDIRS      =&gt; 10,
             CURLOPT_TIMEOUT        =&gt; 30,
             CURLOPT_HTTP_VERSION   =&gt; CURL_HTTP_VERSION_1_1,
             CURLOPT_CUSTOMREQUEST  =&gt; 'GET',
             CURLOPT_HTTPHEADER     =&gt; $headers];
$features = callSpotifyApi($options); 
var_dump($features);

Writing calls to Spotify consistently this way makes it easier to read the code, and find and correct bugs.
I didn't really review how you use the curl options, or whether this is the best way to use the Spotify API. Others may have more experience with this.