Search code examples
phpfile-get-contentsphp-5.3rotten-tomatoes

Is there something wrong with my call to the rotten tomatoes API ? It's returning only 3 movies instead of the number requested?


I am having an issue with the Rotten Tomatoes API, when I set the limit (of movies) to 50, or even 10 movies, it only returns an array containing 3 movies instead of 10 or 50 or whatever the limit of movies is in the API call ... What could be causing that? is there maybe something wrong with the way I am using the file_get_contents function

$box_office_movies = file_get_contents('http://api.rottentomatoes.com/api/public/v1.0/lists/movies/box_office.json?limit=50&country=us&apikey=6gx9znu2958yeztw9tszbrzq',FILE_USE_INCLUDE_PATH);
$box_office_movies = json_decode($box_office_movies, true); 
var_dump($box_office_movies); // returns only 3 movies .. 

Solution

  • var_dump(count($box_office_movies['movies'])); // returns only 3 movies .. 
    

    i get 50 movies. The url returns an array with 3 keys: { movies: {..}, links: {...}, link_template: '...' }

    Seems to work fine here...