Facebook 有多少好友
可能的重复:
如何通过 facebook 获取用户好友列表?< /a>
我有一个 Facebook 应用程序,我想知道用户有多少朋友。当用户通过 Facebook API 登录我的网站时,我设置了权限:
header('Location: ' . $facebook->getLoginUrl(array('req_perms' => 'email, user_birthday, user_location')));
但不知道如何向 Facebook API 询问用户拥有的朋友。我想知道您的电子邮件中包含以下代码:
if($facebook->api(array('method'=>'users.hasAppPermission', 'ext_perm'=>'email')))
{
$myarr = array('method'=>'users.getInfo', 'fields'=>'email', 'uids'=>$uid);
$emailarr = $facebook->api($myarr);
}
有人知道请求该信息的权限和 API 方法吗?提前致谢!。
[已解决] 这个。 API 调用:
$me2 = $facebook->api('/me/friends');
$num_amigos = count($me2['data']);
$me['friends']=$num_amigos;
感谢您的评论!
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!.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
你可以试试这个网址:
https://graph.facebook.com/me/friends?access_token=
也检查一下:http://developers.facebook.com/docs/reference/api/
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/< /a>
Check out the php-sdk @ github : https://github.com/facebook/php-sdk/