Bogomil Shopov

Human. Artist. Hacker. I care about free and open-source software(F/LOSS), cybersecurity, ethical design, privacy, and technology. 20+ experience in technology. 40+ in being human. I encourage people to become better humans with heavy metal and technologies. I also promote technologies to be considerate of humans. Let's see how it goes!

Closed Technologies / Technologies · January 24, 2012

Get number of likes of your/any Facebook page via PHP

If you want to use somewhere the number of people who likes your fan page, here’s the way to do that:

Create
Create a new basic application from here. Just enter some data and you will receive AppID and Secret keys.

Download
Download the PHP library to work with Facebook API.

git clone https://github.com/facebook/php-sdk.git

Write

require('php-sdk/src/facebook.php');
$facebook = new Facebook(array(
	'appId' => '000000000', // put appID here - see Create section
	'secret' => '0000c000c000c000c', //put your secret key here - see Create section
	));
$zt = $facebook->api('/ZeroTurnaround'); // my Facebook page is http://www.facebook.com/ZeroTurnaround
echo $zt['likes'];

Done