首页 > 解决方案 > 我想访问此页面的关注者,但它只显示这么多数据

问题描述

我正在尝试访问此页面的关注者/喜欢者,但它只显示这么多数据。我如何访问此页面的所有信息。

类别“实用程序”链接“ http://localhost/cricshots/ ”名称“cricketshotsofficial”id“1996682000635998”

尝试使用以下代码获取访问权限:

$json_url = 'https://graph.facebook.com/' . $facebook_page_id.'?access_token=' . $access_token ;

期望输出是此页面的完整详细信息或仅是该页面的关注者

标签: phpfb-graph

解决方案


这是一个更新且有效的代码片段,可用于检索特定页面的 Facebook 点赞数。要使用此代码段,您需要 Facebook 应用 ID 和密钥。

<?php
function fbLikeCount($id,$appid,$appsecret){  // $id = Fb Page id
  $json_url ='https://graph.facebook.com/'.$id.'?access_token='.$appid.'|'.$appsecret.'&fields=fan_count';
  $json = file_get_contents($json_url);
  $json_output = json_decode($json);
  //Extract the likes count from the JSON object
  if($json_output->fan_count){
    return $fan_count = $json_output->fan_count;
  }else{
    return 0;
  }
}
echo fbLikeCount('coregenie','___APPID___','___APPSECRET___');
?>

请编辑您的页面名称、应用程序 ID、应用程序密码。


推荐阅读