duanchun6148 2015-03-24 21:52
浏览 63

Facebook Graph API评论计数突然停止工作

Our site uses our own comment system (simple php/mysql) and also the fb comment plugin. I would like to be able to add the comment counts of each to display a single total count of comments from both together. Seems simple enough.

Months ago, I got this working. Then it suddenly stopped working. This morning, I found a new way to do it. Got it working on one page, and by the time I had added the code to all the pages on which we have comments, it was no longer working.

I am pulling my hair out trying to get this working, having virtually zero understanding of json. The FB API explorer gives me an error about auth tokens, but doing what I see recommended has no effect (i.e. creating a new fb app and including the block of auth code they provide).

This is what was working fine at first this am:

    $fbcounturl = 'http://www.catalystathletics.com/articles/article.php?articleID=1902';
    $fbjsonurl = "https://graph.facebook.com/v2.1/?fields=share{comment_count}&id=" .$fbcounturl;
    $fbdata = file_get_contents($fbjsonurl);
    $fbarray = json_decode($fbdata, true);
    $fbcomcount = $fbarray['share']['comment_count'];
    print($fbcomcount);

Then I could simply add $fbcomcount to the $comCount from our db.

If I just browse to the url, I get the json info fine:

    {
    "share": {
    "comment_count": 3
    },
    "id": "http://www.catalystathletics.com/articles/article.php?articleID=1902"
    }

But the $fbcomcount is empty.

Here is an example of a page that would use this - http://www.catalystathletics.com/article/1902/Jumping-Forward-in-the-Snatch-or-Clean-Error-Correction/#comments

Any help would be GREATLY appreciated.

  • 写回答

1条回答 默认 最新

  • douxun4924 2016-02-18 08:03
    关注

    Ran into the same issue recently, Facebook comment count simply stopped working. Eventually tracked down the error in the returned JSOn response, telling me Error #4 Application request limit reached

    {"error":{"message":"(#4) Application request limit 
    reached","type":"OAuthException","is_transient":true,"code":4,"fbtrace_id":"EUNAVRNgnFu"}}`
    

    Here is a good, detailed response on Facebook Open Graph API limits I found elsewhere:

    The Facebook API limit isn't really documented, but apparently it's something like: 600 calls per 600 seconds, per token & per IP. As the site is restricted, quoting the relevant part:

    After some testing and discussion with the Facebook platform team, there is no official limit I'm aware of or can find in the documentation. However, I've found 600 calls per 600 seconds, per token & per IP to be about where they stop you. I've also seen some application based rate limiting but don't have any numbers.

    As a general rule, one call per second should not get rate limited. On the surface this seems very restrictive but remember you can batch certain calls and use the subscription API to get changes.

    As you can access the Graph API on the client side via the Javascript SDK; I think if you travel your request for photos from the client, you won't hit any application limit as it's the user (each one with unique id) who's fetching data, not your application server (unique ID).

    This may mean a huge refactor if everything you do go through a server. But it seems like the best solution if you have so many request (as it'll give a breath to your server).

    Else, you can try batch request, but I guess you're already going this way if you have big traffic.


    If nothing of this works, according to the Facebook Platform Policy you should contact them.

    If you exceed, or plan to exceed, any of the following thresholds please contact us as you may be subject to additional terms: (>5M MAU) or (>100M API calls per day) or (>50M impressions per day).

    评论

报告相同问题?

悬赏问题

  • ¥50 三种调度算法报错 有实例
  • ¥15 关于#python#的问题,请各位专家解答!
  • ¥200 询问:python实现大地主题正反算的程序设计,有偿
  • ¥15 smptlib使用465端口发送邮件失败
  • ¥200 总是报错,能帮助用python实现程序实现高斯正反算吗?有偿
  • ¥15 对于squad数据集的基于bert模型的微调
  • ¥15 为什么我运行这个网络会出现以下报错?CRNN神经网络
  • ¥20 steam下载游戏占用内存
  • ¥15 CST保存项目时失败
  • ¥20 java在应用程序里获取不到扬声器设备