如何使用 Facebook PHP SDK 3.0 在单个请求中获取我所有朋友的个人资料?
我正在尝试检索我所有的朋友,特别是我想获取每个朋友的位置信息(家乡位置和位置),以便将他们放在地图上。我尝试过以下代码,它会引发错误: 您请求的某些别名不存在: 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");
关于如何实现此目的有什么想法吗?
I'm trying to retrieve all my friends, specifically I want to get each friends location information (hometown_location and location) for the purpose of putting them on a map. I've tried the following code, which throws an error: Some of the aliases you requested do not exist: 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");
Any ideas on how I can achieve this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
FQL 查询怎么样: SELECT uid, name, home_location, current_location FROM user WHERE uid IN (SELECT uid2 FROMfriend WHERE uid1=me())
也返回空值,但也不例外,还必须有一种方法可以通过FQL 查询
在这里尝试:
https://developers.facebook.com/tools/explorer
网址:https://graph.facebook.com/fql?q=SELECT uid、姓名、家乡位置、当前位置 FROM user WHERE uid IN (SELECT uid2 FROMfriend WHERE uid1=me())
How about FQL query: SELECT uid, name, hometown_location, current_location FROM user WHERE uid IN (SELECT uid2 FROM friend WHERE uid1=me())
Returns also null values but no exception, there must also be a way to filtering null values via the FQL query
Try it here:
https://developers.facebook.com/tools/explorer
With the 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())