正如主题所说,我正在尝试从 Facebook 页面获取最新评论以及相关的用户数据。我正在使用 Open Graph 和 PHP SDK。
这适用于帖子:
$fql_query = "
SELECT fromid, id, post_id, time, text
FROM comment
WHERE post_id IN (SELECT post_id FROM stream WHERE source_id = '" . $fb_id . "')
ORDER BY time DESC LIMIT 1000";
$feed = $facebook->api(array(
'method' => 'fql.query',
'query' => $fql_query
));
这是获取我需要的用户详细信息的方法:
$fql_query = "
SELECT pic_square, name
FROM user
WHERE uid = '" . $user_id . "'
";
而且,根据我能找到的一切,这应该使用 fql.multiquery 将两者结合起来:
$fql_queries = "{
\"query1\" : \"
SELECT fromid, id, post_id, time, text
FROM comment
WHERE post_id IN (SELECT post_id FROM stream WHERE source_id = '" . $fb_id . "')
ORDER BY time DESC LIMIT 1000
\",
\"query2\" : \"SELECT pic_square, name FROM user WHERE uid IN (SELECT fromid FROM #query1)\"
}";
$feed = $facebook->api(array(
'method' => 'fql.multiquery',
'queries' => $fql_queries
));
但它只返回一个空数组。有谁知道我哪里出错了或者有更好的方法来做我需要的事情?TIA,一如既往。