检索同一应用程序的好友列表facebooksdk4.0(id,name,score.)


Retrieve friend list facebook SDK 4.0 (id,name,score..) of the same app

我正在寻找检索所有使用同一应用程序(PHP SDK 4.)的朋友,包括uid、用户名和分数

我对我的应用程序有以下权限:

("邮件"、"user_about_me"、"用户朋友"、"发布操作",'user_games_activity')

现在,我正在使用这个脚本,它只检索使用同一应用程序的用户的uid:

$me = (new 'Facebook'FacebookRequest($session, 'GET', '/me/friends'))->execute()->getGraphObject('Facebook'GraphUser::className());
$result = $me->asArray();
// Get user's friends
$friends = $result['data'];
// Converting classes to array
foreach ($friends as $key => $value) {
    $friends[$key] = (array)$value;
     echo $friends[0]['id']; //show the id of the user 0
    echo "|";       
}

我有一个问题,只是为了检查所有的朋友,我试图更改这个脚本,但我不能得到所有的朋友。。。[0]

现在,我搜索了很多关于这个话题的。。。但我发现,对于旧的SDK,有了新的,我应该怎么做才能检索同一应用程序的uid、用户名和分数?像这样:

         echo $friends[0]['id']; //show the id of the user 0
        echo "|";   
         echo $friends[0]['name']; //show the name of the user 0
        echo "|";   
         echo $friends[0]['score']; //show the score of the user 0
        echo "|";   

[number_uid0]|[nameusername0]|[score0]|[number_uid1]|[nameusername1]|[score1]等…

非常感谢:)

你不能再得到所有的朋友,只能得到那些也使用你的应用程序的朋友。并且所有friends_*权限都已被删除,因此您不能简单地检索朋友的分数。。。

但看看这里,找到一个解决(我认为是)你的问题的方法:

  • https://developers.facebook.com/docs/games/scores#read-许多分数

您可以通过向/APP_ID/scores发出HTTP GET请求,并使用该应用程序的用户access_token来读取玩家及其朋友的分数集。需要user_friends权限才能查看好友的分数。这将返回玩家和已授权该应用程序的朋友的分数列表。该列表按分值降序排列,因此它首先返回得分最高的朋友。您可以使用此调用为玩家和朋友生成一个排行榜。