I’m using the following code to retrieve the user’s friends list and the info for those friends.
$frnd = $facebook ->api('/me/friends?access_token='.$accessToken.'&fields=id,name,about,hometown');
for ($i=0; $i<$nr_friends; $i++)
{
$friendinfo = $facebook->api('/'.$frnd["data"][$i]["id"].'?fields=id,name,hometown,location');
echo $friendinfo['name']." ".$friendinfo['location']['name']." ".$friendinfo['hometown']['name']."</br>";
}
The problem is, this method takes a lot of time to load the friends info. Is there any way to make this faster?
I think you can condense the querying of friends’ info into one API by passing the IDs as an
idsparameter. I haven’t tested this, but try something similar to the following:I’m not sure on the exact syntax without testing myself, but you should find more information here: http://developers.facebook.com/docs/api#reading