FQL查询以获取喜欢页面的人

时间:2012-05-25 18:03:32

标签: facebook facebook-graph-api facebook-fql

我是Facebook开发的新手,我正在玩一些概念证明。我如何编写查询以获取所有喜欢U2页面的朋友的列表?

我在想这样的事情。

  

var result = fb.Get(“fql”,new {q =“SELECT name FROM user WHERE uid IN(SELECT uid1 FROM friend WHERE uid2 = me())AND'U2'IN like”});

也签到

  

var result = fb.Get(“fql”,new {q =“SELECT checkin_id,author_uid,page_id FROM checkin WHERE author_uid IN(SELECT uid2 FROM friend WHERE uid1 = me())AND page_id IN(SELECT page_id FROM page名称='MyPlace')“});

还有查询构建工具吗?

1 个答案:

答案 0 :(得分:4)

这应该这样做(例如使用PHP SDK(v3.x))

$page_id = ID OF PAGE

$result = $facebook->api(array(
    'method' => 'fql.multiquery',
    'queries' => array(
        'friends_liking_page' => 'SELECT uid, page_id FROM page_fan WHERE uid IN (SELECT uid2 FROM friend WHERE uid1 = me()) AND page_id = ' . $page_id,
        'result' => 'SELECT uid, name, pic FROM user WHERE uid IN (SELECT uid2 FROM friend WHERE uid1 = me() AND (uid2 IN (SELECT uid FROM #friends_liking_page)))'
    )
));

您需要user_likesfriends_likes权限