I’m using the facebook graph PHP sdk – whenever I call the $facebook->api method in a loop I end up getting this error
Fatal error: Maximum execution time of 30 seconds exceeded in C:\Apache\htdocs\fb\application\library\facebook-platform\php\facebook.php on line 509
This is the sample code
$data = $facebook->api('/me/likes');
foreach($data['data'] as $like)
{
$test = $facebook->api($like['id']);
}
Is it because of any limit.
Thanks
Calling the API in a loop like that will have terrible performance. You probably want something like:
This will do most of what you’re doing in one shot. You can add more fields that you use from the response from the call inside the loop.