Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/270.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/kotlin/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何将评论数拉入带有facebook评论的php变量?_Php_Facebook Comments - Fatal编程技术网

如何将评论数拉入带有facebook评论的php变量?

如何将评论数拉入带有facebook评论的php变量?,php,facebook-comments,Php,Facebook Comments,我在我的网站上使用fb评论,我需要把评论的数量拉到一个php变量中,这样我就可以操纵它了。我该怎么做?提前感谢。从FQL表中获取评论框计数: PHP示例: $query = urlencode("select commentsbox_count from link_stat where url = 'http://techcrunch.com/2012/03/31/dramacrunch/'"); $response = json_decode(file_get_contents("https:

我在我的网站上使用fb评论,我需要把评论的数量拉到一个php变量中,这样我就可以操纵它了。我该怎么做?提前感谢。

从FQL表中获取评论框计数:

PHP示例:

$query = urlencode("select commentsbox_count from link_stat where url = 'http://techcrunch.com/2012/03/31/dramacrunch/'");
$response = json_decode(file_get_contents("https://graph.facebook.com/fql?q=$query"), TRUE);
if(!empty($response['data'][0]['commentsbox_count'])) {
    echo $response['data'][0]['commentsbox_count'] . " comments were found!";
}
$query = urlencode("select commentsbox_count from link_stat where url = 'http://techcrunch.com/2012/03/31/dramacrunch/'");
$response = json_decode(file_get_contents("https://graph.facebook.com/fql?q=$query"), TRUE);
if(!empty($response['data'][0]['commentsbox_count'])) {
    echo $response['data'][0]['commentsbox_count'] . " comments were found!";
}