I have a curl script that I have calling Rotten Tomatoes. Every time I run it, even in a for loop from 1 to 10, it runs infinitely. The only way to stop it is by restarting the server, the page continues to call the rotten tomatoes site until the server goes down. The curl script works for other APIs so it should work for this one. Here it is, any idea?:
For the $temp_movie
, that gets its value and works properly.
$ch = curl_init();
$api_link = "http://api.rottentomatoes.com/api/public/v1.0/movies.json?apikey=****&q=".$temp_movie."&page_limit=1";
echo $api_link."<br>";
curl_setopt($ch, CURLOPT_URL, $api_link);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_TIMEOUT, '3');
$content = trim(curl_exec($ch));
curl_close($ch);
$rottentomatoes = json_decode($content, true);