PhpRiot
News Archive
PhpRiot Newsletter
Your Email Address:

More information

Konstantin's Blog: Counting Facebook Fans in PHP: The Graph API Way

Note: This article was originally published at PHPDeveloper on 26 August 2010.
PHPDeveloper

In a quick new post to his blog Konstantin shows how to get the number of fans for a Facebook page with a quick two line piece of code that uses their Graph API.

In a previous blog post called How to Count Facebook Fans in PHP I've shown a code snippet of how to count the number of fans on a fan page using PHP. Times have changed, the Graph API has been introduced, and due to some responses I introduce here the new way of retrieving your fans count using the new Graph API and php.

He uses the Facebook PHP SDK to make the connection and call the "api()" method on a page (his example is the one for Mashable) and return back an array that includes the "fan_count" value.