1

Here is what I have so far. I see 9 results when I visit the URL and after using curl it still displays the 9 results after being printed out. When I used the json_decode function it only created 3 results. I have gone everywhere and havent found anything. A little help in the right direction would be good at this time.

    $ch = curl_init();
    curl_setopt($ch, CURLOPT_URL, $url);
    curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
    curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true );
    // This is what solved the issue (Accepting gzip encoding)
    curl_setopt($ch, CURLOPT_ENCODING, "gzip,deflate");
    $result = curl_exec($ch);
    curl_close($ch);

So when I start to decode it

// decode the json
$resp = json_decode($result, true);

I only get 3 associative arrays because I do a

count($resp);

And figure it out that way. Is there a limit on how much the function json_decode() can do?

Carlitos
  • 419
  • 4
  • 20

1 Answers1

1

I was counting the array in the first brackets so it was always showing 3 results

enter image description here

See when you do a

count($resp);

You are only counting html_attributions, results and status.

If you want count the arrays you would do

count($resp['results']);

That would count the arrays in the results.

Carlitos
  • 419
  • 4
  • 20