我正在尝试检索所有朋友,特别是我希望获取每个朋友的位置信息(hometown_location和location),以便将它们放在地图上。我尝试了下面的代码,它会抛出一个错误:你请求的一些别名不存在:ids = 8689768,86576659,898676(etc)
$friends = $facebook->api("/$user/friends");
foreach($friends['data'] as $key => $friend) {
$friend_list .= ($key!=0) ? "," : "";
$friend_list .= $friend['id'];
}
$friend_profiles = $facebook->api("/ids=$friend_list");
关于如何实现这一目标的任何想法?
答案 0 :(得分:2)
FQL查询怎么样:SELECT uid,name,hometown_location,current_location FROM user WHERE uid IN(SELECT uid2 FROM friend WHERE uid1 = me())
还返回null值但没有异常,还必须有一种通过FQL查询过滤空值的方法
在这里试试:
https://developers.facebook.com/tools/explorer
使用URL:https://graph.facebook.com/fql?q=SELECT uid,name,hometown_location,current_location FROM user WHERE uid IN(SELECT uid2 FROM friend WHERE uid1 = me())