doumo0206 2015-12-08 19:11
浏览 22

PHP,Facebook就像伯爵

I there any way to retrieve facebook like of any single post

Please help me.

I tried to search google and I got the following code

function facebook_count($url){

    // Query in FQL
    $fql  = "SELECT share_count, like_count, comment_count ";
    $fql .= " FROM link_stat WHERE url = '$url'";

    $fqlURL = "https://api.facebook.com/method/fql.query?format=json&query=" . urlencode($fql);

    // Facebook Response is in JSON
    $response = file_get_contents($fqlURL);
    return json_decode($response);

}

$fb = facebook_count('https://www.facebook.com/digital.inspiration');

// facebook share count
echo $fb[0]->share_count;

// facebook like count
echo $fb[0]->like_count;

// facebook comment count
echo $fb[0]->comment_count;
  • 写回答

1条回答 默认 最新

  • dshmvqnl98119 2015-12-08 19:21
    关注
    https://graph.facebook.com/5791561181_10153733325296182?fields=likes.limit(1).summary(true)
    

    That would be the likes for one of the entries on the Page, just replace the Post ID. Of course you need to use an Access Token to make that call. You can use an App Token: App-ID|App-Secret. More information about Tokens: http://www.devils-heaven.com/facebook-access-tokens/

    Btw, FQL is deprecated, don´t use it anymore.

    评论

报告相同问题?

悬赏问题

  • ¥15 有了解d3和topogram.js库的吗?有偿请教
  • ¥100 任意维数的K均值聚类
  • ¥15 stamps做sbas-insar,时序沉降图怎么画
  • ¥15 unity第一人称射击小游戏,有demo,在原脚本的基础上进行修改以达到要求
  • ¥15 买了个传感器,根据商家发的代码和步骤使用但是代码报错了不会改,有没有人可以看看
  • ¥15 关于#Java#的问题,如何解决?
  • ¥15 加热介质是液体,换热器壳侧导热系数和总的导热系数怎么算
  • ¥100 嵌入式系统基于PIC16F882和热敏电阻的数字温度计
  • ¥15 cmd cl 0x000007b
  • ¥20 BAPI_PR_CHANGE how to add account assignment information for service line