Extract token from response url - Spotify API
You need to decode the JSON:
$response = json_decode($response, true);
Then you'll have an array with the values.
$token = $response['access_token'];
Also, you're missing a necessary option to obtain the response in this way:
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
If not defined, you will get a boolean value instead of the response.