How many friends on Facebook
Possible Duplicate:
How to get a list of user's friends via facebook?
I have a Facebook App and I want to know how many friends a user has. When the user login on my web through Facebook API, I setup the permissions:
header('Location: ' . $facebook->getLoginUrl(array('req_perms' => 'email, user_birthday, user_location')));
But dunno how to ask Facebook API about the friends that a user has. Im wondering your email with this code:
if($facebook->api(array('method'=>'users.hasAppPermission', 'ext_perm'=>'email')))
{
$myarr = array('method'=>'users.getInfo', 'fields'=>'email', 'uids'=>$uid);
$emailarr = $facebook->api($myarr);
}
Anyone knows the permission and the API method to request that info?. Thanks in advance!.
[SOLVED] With this one. The API call:
$me2 = $facebook->api('/me/friends');
$num_amigos = count($me2['data']);
$me['friends']=$num_amigos;
Thanks for your comments!.
You can try this url: https://graph.facebook.com/me/friends?access_token=<ACCESS_TOKEN>
Check this too: http://developers.facebook.com/docs/reference/api/
看看php-sdk @ github:https://github.com/facebook/php-sdk/
链接地址: http://www.djcxy.com/p/75428.html下一篇: Facebook上有多少朋友