如何使用 Facebook PHP SDK 3.0 在单个请求中获取我所有朋友的个人资料?

发布于 2024-12-13 17:02:16 字数 407 浏览 0 评论 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

吾家有女初长成 2024-12-20 17:02:16

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())

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文