Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Get users' Facebook Likes with FQL

Hello everyone I am trying to get my friends 's likes on FB using FQL

'SELECT name,type FROM page WHERE page_id IN (SELECT target_id  FROM connection WHERE source_id=%i and target_type="Page") AND type!="APPLICATION"'%(friend.fb_uid))

The query works as expected when I am asking for my own likes but return nothing for my friends. I have added the likes permission but still nothing.

Any ideas?

like image 984
PanosJee Avatar asked Jul 09 '10 08:07

PanosJee


2 Answers

The page_fan table here http://developers.facebook.com/docs/reference/fql/page_fan might work for your use case (I'm going to check why the connections table has different behaviour). Try something like:

'SELECT name, type FROM page WHERE page_id IN (SELECT page_id FROM page_fan WHERE uid=%i) AND type != "APPLICATION"'%(friend.fb_uid)

This is of course after asking for the friends_likes permission.

like image 150
daaku Avatar answered Oct 19 '22 19:10

daaku


The user has to grant your application the user_likes permission before you can do that.

And if you're going to do while the user is not logged in, you'll need to prompt them for the offline_access permission as well.

http://developers.facebook.com/docs/authentication/

like image 24
Peter Bailey Avatar answered Oct 19 '22 18:10

Peter Bailey