开发者

How can I get user id for likes of my page?

开发者 https://www.devze.com 2023-04-01 11:21 出处:网络
I\'m developing for a Facebook page with Graph API, and would like to know how to get the user IDs of users who like m开发者_开发技巧y Page, even though I can get picture and name of those fans using

I'm developing for a Facebook page with Graph API, and would like to know how to get the user IDs of users who like m开发者_开发技巧y Page, even though I can get picture and name of those fans using the social plugin.

I've tried the following methods with no luck:

Two graph methods:

  • graph.facebook.com/page_id/members/ doesn't work
  • graph.facebook.com/page_id/members/user_id works, but one by one

Two FQL queries:

SELECT uid FROM page_fan WHERE page_id="124618122608487" and uid=me() 
-- works, but one by one

SELECT uid FROM page_fan WHERE page_id="124618122608487" 
-- doesn't work


Facebook won't tell you who likes your page, just an aggregate total number.

Note: for privacy reasons it is not possible to query for all users who like a Page.

http://developers.facebook.com/docs/reference/fql/like/


You do not need to log in to the page you may like to know about the signed request: here is my example code:

<?php

list($a, $b) = explode('.', $_REQUEST["signed_request"], 2);
$data = json_decode(base64_decode(strtr($b, '-_', '+/')), true);
print_r($data);

?>


It's not possible by default. But you can use Facebook Connect to get a user to be logged and then you can get info about him.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号