Php 带有文件\u get\u内容的Facebook FQL返回空数组

Php 带有文件\u get\u内容的Facebook FQL返回空数组,php,facebook,facebook-graph-api,Php,Facebook,Facebook Graph Api,我使用FQL脚本直接在我的网站中回显我网站URL的Facebook评论。然而,有些URL返回一个空数组,即使我直接访问Facebook API,我可以看到它们充满了评论。这仅适用于最新的URL。这是我使用的代码: $queries = array('q1' => 'select post_fbid, fromid, object_id, text, time from comment where object_id in (select comments_fbid from link_st

我使用FQL脚本直接在我的网站中回显我网站URL的Facebook评论。然而,有些URL返回一个空数组,即使我直接访问Facebook API,我可以看到它们充满了评论。这仅适用于最新的URL。这是我使用的代码:

$queries = array('q1' => 'select post_fbid, fromid, object_id, text, time from comment where object_id in (select comments_fbid from link_stat where url ="'.$url.'")',
             'q2' => 'select post_fbid, fromid, object_id, text, time from comment where object_id in (select post_fbid from #q1)',
             'q3' => 'select name, id, url, pic_square, username from profile where id in (select fromid from #q1) or id in (select fromid from #q2)',
             'q4' => 'select uid, first_name from user where uid in (select fromid from #q1) or uid in (select fromid from #q2)',
             );
$result = (file_get_contents('http://api.facebook.com/restserver.php?format=json-strings&method=fql.multiquery&queries='.urlencode(json_encode($queries)));
现在,如果我回显$result变量,我会看到:

[{“名称”:“q1”,“fql_结果集”:[]},{“名称”:“q2”,“fql_结果集”:[]},{“名称”:“q3”,“fql_结果集”:[]},{“名称”:“q4”,“fql_结果集”:[]}]

尽管我在API url(API.facebook.com等)中看到fql_结果集已满。有人能解释我这种奇怪的行为吗?:-)

该端点已弃用。改用。请参阅作为参考

此外,还需要确保查询之间的引用是正确的。查看并阅读您可以使用的JSONPATH语法

更改的查询:

$queries = array('q1' => 'select post_fbid, fromid, object_id, text, time from comment where object_id in (select comments_fbid from link_stat where url ="'.$url.'")',
             'q2' => 'select post_fbid, fromid, object_id, text, time from comment where object_id in ({result=q1:$.data.*.post_fbid})',
             'q3' => 'select name, id, url, pic_square, username from profile where id in ({result=q1:$.data.*.fromid}) or id in ({result=q2:$.data.*.fromid})',
             'q4' => 'select uid, first_name from user where uid in ({result=q1:$.data.*.fromid}) or uid in ({result=q2:$.data.*.fromid})',
             );
我不理解你的问题:

  • q2或多或少是q1的副本
  • 第三季度的信息也可以通过修改第四季度来检索

Hi Tobi,我尝试更改URL(从api更改为图形),但仍然得到相同的结果:[{“名称”:“q1”,“fql_结果集”:[]},{“名称”:“q2”,“fql_结果集”:[]},{“名称”:“q3”,“fql_结果集”:[]},{“名称”:“q4”,“fql_结果集”:[]}],即使fql_结果集在URL中不是空的,您是否已逐个处理请求?他们工作吗?