我正在使用Facebook评论插件来为我的博客提供评论功能,直到现在,Facebook图形API帮助我检索网站上每篇文章的评论计数。因此,就像我所说的那样,我可以使用PHP和json_decode来检索一个月前发布的文章的评论计数:
通常情况下,因为“评论”行出现而起作用。我不知道为什么,但现在,我创建的每篇新文章都没有“评论”和“分享”行。所以,这是我从https://graph.facebook.com/?ids=http://www.example.com/title-of-the-post/得到的。
旧文章:
新文章:
“评论”一行不再显示,现在我有更多的信息(一些我不关心的信息)。那么,发生了什么?我根本没有改变我的代码!顺便说一句,我的评论框仍然可以工作,并显示所有的评论(我的点赞按钮正确地显示了“分享”计数)。有人能帮我吗?
$wsurl = 'http://www.example.com/title-of-the-post/';
$wsjson = json_decode(file_get_contents('https://graph.facebook.com/?ids='.$wsurl));
$cmcount = ($wsjson->$wsurl->comments) ? $wsjson->$wsurl->comments : 0;
通常情况下,因为“评论”行出现而起作用。我不知道为什么,但现在,我创建的每篇新文章都没有“评论”和“分享”行。所以,这是我从https://graph.facebook.com/?ids=http://www.example.com/title-of-the-post/得到的。
旧文章:
{
"http://www.example.com/title-of-the-post/": {
"id": "http://www.example.com/title-of-the-post/",
"shares": 6,
"comments": 6
}
}
新文章:
{
"http://www.example.com/title-of-the-post/": {
"url": "http://www.example.com/title-of-the-post/",
"type": "website",
"title": "Title of the post",
"image": [
{
"url": "http://www.example.com/thumb.png"
}
],
"description": "This is a great post about great things.",
"updated_time": "2012-12-25T17:57:03+0000",
"id": "66666666666666"
}
}
“评论”一行不再显示,现在我有更多的信息(一些我不关心的信息)。那么,发生了什么?我根本没有改变我的代码!顺便说一句,我的评论框仍然可以工作,并显示所有的评论(我的点赞按钮正确地显示了“分享”计数)。有人能帮我吗?