I try to get somehow the number of Facebook followers using hybridauth. I am using the following code:
$hybridauth = new Hybrid_Auth( $config );
$adapter = $hybridauth->authenticate( "facebook" );
echo var_dump($adapter->api()->api('/me/subscribers'));
However, the output is:
array (size=2)
'data' =>
array (size=0)
empty
'summary' =>
array (size=1)
'total_count' => int 0
I have a Facebook account created for development and I have a lot of friends already there (just like Stan Marsh in the South Park episode about Facebook). If, instead if '/me/subscribers' I try with '/me/friends' then I get a list of friends with a paging. I have tried to raise the number of my followers, I have created another (sigh) Facebook user and with that I have visited my page and have clicked on the Interest list of my profile. I have then tested my code again. Still 0 followers. What am I doing wrong?
After connecting with facebook we have to run something like this:
private function getFacebookData($username) {
try{
$counter = $this->adapter->api()->api($username."/subscribers")["summary"]["total_count"];
return "Number of followers is: ".$counter;
}
catch( Exception $e ){
return( "<b>got an error!</b> " . $e->getMessage() );
}
}