Facebook graph api 列出所有批准您的FB申请的朋友
我需要显示批准我申请的朋友的姓名。我用这个代码向我的朋友发送请求Facebook graph api 列出所有批准您的FB申请的朋友,facebook-graph-api,request,friend,Facebook Graph Api,Request,Friend,我需要显示批准我申请的朋友的姓名。我用这个代码向我的朋友发送请求 FB.getLoginStatus(function(response) { if (response.authResponse) { FB.ui({ method: 'apprequests', message: 'Hey guys check this out' }); } }); 我试图从其他论坛搜索答案,但没有找到
FB.getLoginStatus(function(response) {
if (response.authResponse) {
FB.ui({
method: 'apprequests',
message: 'Hey guys check this out'
});
}
});
我试图从其他论坛搜索答案,但没有找到任何答案。请帮忙
提前感谢。当你的应用程序在收件人接受请求时处理请求时,你需要将其保存在你自己的数据库中,如果你已经实例化了facebook类(此处为“$Fb”),则无法随后查询该信息的API, 考虑到你的身份证和秘密。。。 “$user”是我们想要好友列表的用户的facebook“user_id”(即12345678…)
$access_token = $Fb->getAccessToken();
$user_profile = $Fb->api('/me');
// show user image
$txt .= "<p align=\"center\">
<img src=\"https://graph.facebook.com/".$user."/picture\"></p>";
$FBid = $user_profile['id'];
$FBnick = $user_profile['username'];
$txt .= fb_friends_list($user_profile,$access_token);
echo ($txt);
$access_token=$Fb->getAccessToken();
$user_profile=$Fb->api('/me');
//显示用户图像
$txt.=“
”;
$FBid=$user_profile['id'];
$FBnick=$user_profile['username'];
$txt.=fb\U好友列表($user\u profile,$access\u token);
echo($txt);
//以上调用以下函数获取好友列表:
function fb_friends_list($fbup,$access_token)
{
// display the friends list on 3 columns, with their avatar.
global $Sess,$Fb;
$friends = $Fb->api('/me/friends'); // return an array [data][0 to n][name]/[id]
$siz = sizeof($friends['data']);
$txt = "<h3 align=\"center\">Your FRIENDS on FACEBOOK</h3>";
$txt .= "<table align=\"center\">
<tr>
<td class=\"blu s12 bld\">Friend's<br />Avatar</td>
<td class=\"blu s12 bld\">Friend's Name</td>
<td width=\"30px\"> </td>
<td class=\"blu s12 bld\">Friend's<br />Avatar</td>
<td class=\"blu s12 bld\">Friend's Name</td>
<td width=\"30px\"> </td>
<td class=\"blu s12 bld\">Friend's<br />Avatar</td>
<td class=\"blu s12 bld\">Friend's Name</td>
</tr>";
$col = 0;
for ($i=0; $i<$siz; $i++)
{
$fid = $friends['data'][$i]['id'];
$src = "http://graph.facebook.com/".$fid."/picture";
if ($col == 0)
$txt .= "<tr>";
$txt .= "<td><img src=\"".$src."\" /></td>";
$txt .= "<td>".$friends['data'][$i]['name'] . "</td>";
$txt .= "<input type=\"hidden\" name=\"".$fid."\" />";
$col++;
if ($col < 3)
$txt .= "<td width=\"30px\"> </td>";
if ($col == 3)
{
$col = 0;
$txt .= "</tr>";
}
}
if ($col != 0)
$txt .= "</tr>";
$txt .= "</table>";
return($txt);
}
功能fb\u好友列表($fbup,$access\u令牌)
{
//在3列中显示好友列表及其头像。
全球$Sess,$Fb;
$friends=$Fb->api('/me/friends');//返回数组[data][0 to n][name]/[id]
$siz=sizeof($friends['data']);
$txt=“你在FACEBOOK上的朋友”;
$txt.=”
朋友的化身
朋友的名字
朋友的化身
朋友的名字
朋友的化身
朋友的名字
";
$col=0;
对于($i=0;$i)