0

I want to get all the Facebook pages and their fan count of user accounts using Facebook graph API, I also create one app in Facebook developer account, but then after don't know what to do to get page list?

So, can someone help me to write the correct PHP code to retrieve the page list?

I had some code as below :

     $json_url ='https://graph.facebook.com/'.$page_id.'?access_token='.$fb_api_key.'|'.$fb_api_secret.'&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){
      echo $fan_count = $json_output->fan_count;
    }else{
      echo 0;
    }`
3
  • What exactly is the issue? Please at least point us to the documentation of the endpoints you want to call, to get this data. Or are you asking us to read the documentation and find such endpoints for you? The latter isn't a service we offer on Stackoverflow.
    – ADyson
    Commented Jan 11, 2023 at 10:09
  • I am looking for facebook page fan count and followers Commented Jan 11, 2023 at 12:50
  • Yes, you already said that. Did you understand my comment? Please also see How to Ask and the tour for more guidance on how to ask a useful question on Stackoverflow.
    – ADyson
    Commented Jan 11, 2023 at 13:08

0