24

Possible Duplicate:
Retrieve Facebook Fan Names

I wanna get a list of facebook users who like a page or interest.

FQL like 'SELECT user_id FROM like WHERE object_id=113970468613229' does not work.

Is there a way to do this?

Community
  • 1
  • 1
OmniBus
  • 854
  • 1
  • 6
  • 25

6 Answers6

60

I am Partner Engineer at Facebook so I thought I'd chime in here. The Facebook APIs will not give you the user ID of users who have liked a page or interest, this is to guard the privacy of those users.

Jonathan Dean
  • 1,112
  • 7
  • 9
  • how about the actual NAME of the users? – SF Developer Dec 29 '11 at 22:38
  • 28
    Then why can I see the users who like my page under "New Likes" on the actual page? Seems a bit inconsistent to "protect" user privacy in one area but not the other. – AdamB Jul 30 '12 at 16:27
  • 6
    If I can see the likes in the page itself, via browser, but not from the APIs, it's not related to guard the user privacy! – Natan R. Nov 15 '12 at 10:41
  • @Jonathan Dean what the above user said is right. If I can view the user likes of a particular page in my own page then why shouldn't I get it using my code – lulu Feb 23 '14 at 05:28
  • It's not to guard user's privacy, it's to stop spammers collecting ID's from a targeted page (such as a weight loss page) and spamming them with weight loss products. I learn't this from Facebook's security team. I worked on a bug relating to this some time ago for Facebook. – James Jeffery Sep 05 '14 at 23:06
  • 1
    @Jonathan So, even for the page_admin also it is not possible to get the User ids of the people who liked his page in API? Could you please let us know whether it is possible for admin to get the page likes info... – Azeez Sep 29 '14 at 06:54
  • They don't want you to go out of facebook platform. You can see the userid based on likes on facebook itself but not on your own website. If they do, soon traffic will go out of facebook. IMHO – kittu Mar 04 '17 at 06:31
11

There is no way to get a list of people that like your page via their API, which is why this question never got answered. You can get charts and aggregate information about who like your page from Facebook Insights but it is not personally identifiable information like their user id.

You can see the most recent 500 users that have like your page by going to: https://www.facebook.com/browse/?type=page_fans&page_id=your page id but you would have to scrape this to get the information and it won't work for more people besides the most recent 500.

bkaid
  • 51,465
  • 22
  • 112
  • 128
6

It isn't possible to get the ids of users who like your page unfortunately.

You can use the like box to show a facepile of users who like your page. And as haha said you can detect if one user likes a page.

For the likebox/facepile option check out the docs at: Likebox

squinlan
  • 1,795
  • 15
  • 19
4

According to the facebook api that is exactly how you do it. Except it says you should have quotes around your object_id.

The example says:

$facebook->api_client->fql_query('SELECT user_id FROM like WHERE object_id="122706168308"');

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

sakibmoon
  • 2,026
  • 3
  • 22
  • 32
gautema
  • 634
  • 5
  • 16
4

The FQL docs have been updated to clarify this limitation: https://developers.facebook.com/docs/reference/fql/like/

J Starr
  • 984
  • 6
  • 19
-1

With Facebook PHP-SDK you can use this

if($me) {
$youlikeit =  $facebook->api(array(
    "method" => "fql.query",
    "query"  => "select uid from page_fan where uid=me() and page_id=113970468613229"
));
}
$youlikeit = sizeof($youlikeit) == 1 ? true : false;
sakibmoon
  • 2,026
  • 3
  • 22
  • 32
haha
  • 1,522
  • 2
  • 15
  • 18
  • Never mind. It can only check the user is on the user list of a page, not get the user list of a page. – OmniBus Apr 20 '11 at 08:27