Facebook Graph API - 查找用户热门的朋友 [英] Facebook Graph API - Finding a users top friends
问题描述
任何人都有任何指针?
另一种做法是,为用户发布的状态消息,已评论或喜欢他的状态的朋友是与他/她进行交互最多的朋友,这样做很简单,您可以使用以下内容:
$ statuses = $ facebook-> api('/ me / statuses');
foreach($ statuses ['data'] as $ status){
//处理喜欢阵列来计算粉丝群。
foreach($ status ['likes'] ['data'] as $ likesData){
$ frid = $ likesData ['id'];
$ frname = $ likesData ['name'];
$ friendArray [$ frid] = $ frname;
}
foreach($ status ['comments'] ['data'] as $ comArray){
//处理用于计算fanbase的注释数组
$ frid = $ comArray ['from'] ['id'];
$ frname = $ comArray ['from'] ['name'];
}
}
根据您的选择保留柜台,这将是完成。
I am writing a android app that will pull in a list of all the users friends so they can tag them in the photo but displaying a large box of the friends with their photo instead of a list. Because some people have 500+ friends, we all know their are only a handful (maybe 50) that are friends they actively communicate on Facebook by comments or being tagged in photos. I would like to be able to just pull their top xxx friends as it seems Facebook does this same thing on their site, but I just cant find anything in the Graph API to do this task.
Anyone have any pointers?
The other way of doing it is, make a Graph API request for the status messages posted by the user, the friends who have commented or liked his status are the ones with whom he/she interacts the most, doing this is pretty simple, you can use this:
$statuses = $facebook->api('/me/statuses');
foreach($statuses['data'] as $status){
// processing likes array for calculating fanbase.
foreach($status['likes']['data'] as $likesData){
$frid = $likesData['id'];
$frname = $likesData['name'];
$friendArray[$frid] = $frname;
}
foreach($status['comments']['data'] as $comArray){
// processing comments array for calculating fanbase
$frid = $comArray['from']['id'];
$frname = $comArray['from']['name'];
}
}
keep counters as per your choice, and it will be done.
这篇关于Facebook Graph API - 查找用户热门的朋友的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!