I am calling a Json Array from an API. My doubt is about the way I am getting all the data.
The API has a section to try out the response you should be getting from the API and when I do it I am getting data listed like here
as you can see there are 10 rows going from 0 to 9. But when I am calling the Json array, I am getting this here
as you can see it is all messy.
why is this happening ?? and how can I fix it ?.
I am calling data like this:
$curl = curl_init();
//adding fields to the curl object to enter the site
curl_setopt($curl, CURLOPT_URL, $my_url);
curl_setopt($curl, CURLOPT_HTTPHEADER, $headers);
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, 0);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl, CURLOPT_ENCODING, 'gzip,deflate');
//executing the curl call and getting data back
$json = curl_exec($curl);
curl_close($curl); // close the connection
echo $json;