获取喜欢我的页面的人的用户 ID

发布于 2024-11-02 21:19:20 字数 431 浏览 4 评论 0原文

我想捕获喜欢我的应用程序的人的用户 ID。在 page_fan fql 页面上,它显示:“查询此表以返回有关 Facebook 页面粉丝的信息。您可以在没有 auth_token 或会话密钥的情况下查询此表。”

我正在使用以下代码:

$data = $facebook->api( array( 'method' => 'fql.query', 'query' => 
'SELECT uid FROM page_fan WHERE page_id="page_id" and uid="'.$me['id'].'"' ) );
print_r($data);

//if the user is fan, uid will be returned, otherwise, an empty array.

我只得到一个空数组。我不想请求扩展权限。

I would like to capture the user id of a person that has liked my application. On the page_fan fql page it says, "Query this table to return information about the fan of a Facebook Page. You can query this table without an auth_token or a session key."

I am using the following code:

$data = $facebook->api( array( 'method' => 'fql.query', 'query' => 
'SELECT uid FROM page_fan WHERE page_id="page_id" and uid="'.$me['id'].'"' ) );
print_r($data);

//if the user is fan, uid will be returned, otherwise, an empty array.

I only get a null array. I don't want to ask for extended permissions.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

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

发布评论

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

评论(2

久而酒知 2024-11-09 21:19:20

无法使用 API 获取主页粉丝列表。您只能朝另一个方向前进 - 向单个用户请求权限(user_likes) 然后找出他喜欢哪些页面。但是,您可以使用页面选项卡来检测点击您的应用程序的用户何时喜欢其所在的页面。您甚至不需要权限。这是您能够达到的最接近的距离。

有关如何检测查看用户是否是粉丝的详细信息,请参阅 signed_request参数文档。

There is no way to get a list of Page fans using the API. You can only go in the other direction -- ask a single user for permissions (user_likes) and then find out what pages he likes. However, you can use Page Tabs to detect when a user that hits your app likes the Page that it's on. You don't even need permissions for this. That is the closest you're going to be able to get.

Details on how to detect whether the viewing user is a fan can be found in the signed_request parameter documentation.

最笨的告白 2024-11-09 21:19:20

删除 "uid="'.$me['id'].'" 部分,这样您就可以获得所有粉丝 - 您可能会以页面身份登录,并且页面不能喜欢自己..但这只是一个选项。

或者,您可以使用图形 api 来获取页面的成员(即,谁喜欢它):

https://graph.facebook.com/[PAGEID]/members?limit=500&access_token=[oauthtoken]

[oauthtoken] = 任何令牌 - 您不必请求扩展权限。

remove the "uid="'.$me['id'].'" part so you would get all the fans - you might be logged in as the page, and a page can not like itself.. but thats just an option.

Alternatively you can use the graph api to get the members of a page (ie, who liked it):

https://graph.facebook.com/[PAGEID]/members?limit=500&access_token=[oauthtoken]

[oauthtoken] = any token - you dont have to ask for extended permissions.

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