$per_page, 'order' => $order, 'thumbsize' => $thumbsize, 'query' => $query, 'page' => $page ); $response = EpornerAPICall($api_url, $params); if($response) { $json = json_decode($response); return $json; } return false; } $page = 1; //start from first page $total_pages = 1; //will be set to real value after success API call $max_videos_to_fetch = 10000; //limit max videos to fetch in loop $fetched_videos = 0; //internal counter do { $apiResponse = getEpornerVideos($page, 'all', 1000, 'most-popular', 'big'); //1000 videos per api request, order by 'most-popular', big thumbs //you can change 'all' to any other phrase you would like to search if($apiResponse) { $videos = $apiResponse->videos; $page = $apiResponse->page + 1; $total_pages = $apiResponse->total_pages; foreach($videos as $video) { if($fetched_videos >= $max_videos_to_fetch) break; $fetched_videos++; echo 'Video #' . $fetched_videos . PHP_EOL; echo $video->id . PHP_EOL; echo $video->title . PHP_EOL; echo $video->url . PHP_EOL; //you can access here all video fields described in Results of ID Method } } else { //we have an error : ( } } while ( $page < $total_pages && $fetched_videos < $max_videos_to_fetch ); ?>

Main Menu