8

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?

ow3n
  • 5,974
  • 4
  • 53
  • 51
PanosJee
  • 3,866
  • 6
  • 36
  • 49
  • Did you ever figure out what the problem with this is or how to get around it? Just ran into the same myself, and asking the Internet hasn't helped so far... – Alexander Rautenberg Jan 28 '11 at 12:19
  • Any updates? I just posted a similar question except for ALL likes over here: http://stackoverflow.com/questions/6528850/get-all-of-a-users-likes-all-of-them-with-fql – ow3n Jun 30 '11 at 00:43

2 Answers2

4

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.

daaku
  • 2,797
  • 20
  • 20
  • You can't query **page_fan** after requesting **friends_likes**? My repro case works fine: http://fbrell.com/bugs/friends-pages – daaku Jul 11 '10 at 23:48
  • Seems like it happens when your friend have also authorized the application to access page likes – qasimzee Aug 12 '11 at 14:25
1

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/

Peter Bailey
  • 105,256
  • 31
  • 182
  • 206
  • I have done both. The problem is when i am asking for the likes of the user 's friend. After a lot of tinkering I believe it s not doable though. – PanosJee Jul 09 '10 at 16:02
  • That requires the `friends_likes` permission I believe - I've not personally messed with any of the `friends_*` permissions before. Any reason you're not reading the connection from the graph, though? i.e., `/USER_ID/likes` ? – Peter Bailey Jul 09 '10 at 16:28
  • friends_likes perm is there i do not use the graph for the time being because of some legacy code, i ll have to upgrade to the graph anyway sooner or later – PanosJee Jul 11 '10 at 11:08
  • I came across the same problem. Trying the $facebook->api('me/likes') does not work. But if i go to graph api demo page and run the link, it works. – codingbbq Mar 04 '11 at 09:58