How to force abstract JSON data only from an API response?


I’m trying to make a request to an API via PHP cURL

$access_token = $tokens['access_token'];
$headers = array(
  "Authorization: Bearer " . $access_token

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,env('USER_INFO'));
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "GET");
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 10);
curl_setopt($ch, CURLOPT_TIMEOUT_MS, 1000);
curl_setopt($ch, CURLOPT_VERBOSE, TRUE);
curl_setopt($ch, CURLOPT_ENCODING , "gzip");
curl_setopt($ch, CURLOPT_USERAGENT,'php');
curl_setopt($ch, CURLOPT_HTTPHEADER,$headers);
$info = curl_getinfo($ch);

$userInfo = curl_exec($ch);
$userInfo = json_decode($userInfo, true);


I kept getting this back


Try #2

If I do

$userInfo = json_encode($userInfo, true);

I got


How do I get rid of the 1 or true below it, and only get the JSON data ?

Is there another param for json_decode() that I need to pass in ?


How would one go about and debug this further ?

I’m open to any suggestions at this moment.

Any hints/suggestions / helps on this be will be much appreciated!

For more info please click here

Have a question or need a custom quote?