I am currently using Facebook's PHP API to gather data of mutual friends. I am currently querying as suggested in here: Facebook mutual friends and FQL 4999/5000 record limit, using the array_chunk method. Can I ask what are the possible reasons for the above error thrown? What are the possible resource limitations?
At first, I tried to increase the memory limit of the php script to 128MB, but I used memory_get_usage(true) and it gave me a number much less than that (after conversion, it was less than 3MB) when I caught the above-mentioned Facebook error.
Is this a resource limitation due to Facebook, or my script?
Here is my written code:
$chunked_friends = array_chunk($all_friends_id, 100); // we use 100 for now, if there is loss of information, then we consider another way
foreach ($chunked_friends as $array) {
$mutualfriends = $facebook->api(array(
'method' => 'fql.query',
'query' => 'SELECT uid1, uid2 FROM friend
WHERE uid2 IN
(SELECT uid2 FROM friend WHERE uid1=me())
AND uid1 < uid2
AND uid1 IN ( '. implode(', ', $array) .' )'
));
foreach ($mutualfriends as $mutualfriend) {
$returned_array["links"][] = array("source" => $mutualfriend['uid1'], "target" => $mutualfriend['uid2']);
}
usleep(200000);
}
Edit: I am using heroku to develop my app currently.