As the subject says, I am trying to get the most recent comments from a Facebook page, with associated user data. I am using Open Graph & the PHP SDK.
This works fine for the posts:
$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
));
And this is how to get the user details I need:
$fql_query = "
SELECT pic_square, name
FROM user
WHERE uid = '" . $user_id . "'
";
And, according to everything I can find, this should combine the two using 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
));
But it just returns an empty array. Does anyone know where I'm going wrong or have a better method to do what I require? TIA, as always.