pmr*_*ule 3 facebook facebook-graph-api facebook-comments
我正在为我的博客使用facebook评论插件,直到现在,facebook图表api帮助我检索了我网站上每个帖子的评论数.所以,正如我所说,我写的帖子就像一个月前一样,我可以使用php和json_decode检索注释计数,如下所示:
$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"
   }
}
"评论"行不再显示,我现在有更多信息(一些我不在乎的信息).所以发生了什么事?我根本没有改变我的代码!顺便说一下,我的评论框仍在工作并显示所有评论(而我的按钮显示正确的"份额"计数).有人能帮助我吗?
对我来说看起来像个错误.FQL查询是一种仍然有效的替代方案.这是一个例子:
select comment_count, share_count, like_count from link_stat where url = "http://techcrunch.com/2011/04/12/facebook-comments-now-on-over-50k-sites-get-more-social-with-latest-upgrade/"
在这里尝试API Explorer:http://developers.facebook.com/tools/explorer/?fql = select%20comment_count%2C%20share_count%2C%20like_count%20from%20link_stat%20where%20ur %% 20%3D%20%22http %3A%2F%2Ftechcrunch.com%2F2011%2F04%2F12%2Ffacebook-意见,现在已经上过50K-网站-GET-更多的社交与-最新升级%2F%22
但是,如果他们更改Graph API以再次返回共享计数和评论计数,我会很高兴.
这个官方Facebook文档(developers.facebook.com/docs/reference/plugins/comments/)仍然建议使用Graph API进行评论计数,但它似乎不适用于这样的新页面:https:// graph. facebook.com/?ids=http://techcrunch.com/2012/12/27/the-last-imac-question-mark/
| 归档时间: | 
 | 
| 查看次数: | 6142 次 | 
| 最近记录: |