我为我的博客使用Facebook评论插件,直到现在,facebook图表API帮助我检索了我网站上每篇文章的评论数。所以,正如我说的,我已经写了像一个月前的文章中,我可以使用PHP和json_decode这样检索评论数:Facebook Graph Api网址评论和分享数量不再有效
$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"
}
}
“注释”行不再出现了,我现在有更多的信息(一些我不关心的信息)。所以发生了什么事?我根本没有更改我的代码!顺便说一下,我的评论框仍在工作,并显示所有评论(和我喜欢的按钮显示“股份”计数正确)。有人能帮助我吗?
非常感谢!它完美的作品! – pmrotule