I'd like to get a list of users who like a certain page or a fan of it.
The FB API documentation states that you can only get the count of the fans of a certain page using the social graph, but not a list of the fans.
A discussion here Retrieve Facebook Fan Names suggests that one could use an FQL query like SELECT user_id FROM like WHERE object_id="YOUR PAGE ID"
to get the number of people who liked the page, but for the same page, it gives an empty response "{}".
So I was wondering if anyone has an idea if this can be done.
Best Answer
There is a "way" to get some part of fan list with their profile ids of some fanpage without token.
Get id of a fanpage with public graph data: http://graph.facebook.com/cocacola - Coca-Cola has 40796308305.UPDATE 2016.04.30: Facebook now requires access token to get page_id through graph so you can parse fanpage HTML syntax to get this id without any authorization fromhttps://www.facebook.com/{PAGENAME}
as in example below based on og tags present on the fanpage.If you are interested only in profile ids use the graph api again - it will give you profile id directly: http://graph.facebook.com/michal.semeniukUPDATE 2016.04.30: Facebook now requires access token to get such info. You can parse profile HTML syntax, just like in the first step meta tag is your best friend:<meta property="al:android:url" content="fb://profile/{PROFILE_ID}" />
And now is the best part: try to refresh (F5) the link in point 2.. There is a new full set of another fans of Coca-Cola. Take only uniques and you will be able to get some nice, almost full list of fans.
-- UPDATE 2013.08.06 --
Why don't you use my ready PHP script to fetch some fans? :)
UPDATE 2016.04.30: Updated example script to use new methods after Facebook started to require access token to get public data from graph api.