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

January 24, 2012
By Bogomil Shopov
Post Image

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

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

Download the PHP library to work with Facebook API.

git clone


$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
echo $zt['likes'];


Bogomil Shopov

I care about privacy, ethical design, and freedom in many aspects. I spend 20+ years working as a web developer and architect, analyst, manager, and product owner/manager in different environments, several countries, and multiple software industries like Healthcare and Hospitality. I wore many hats, and I use the knowledge gathered to optimize the flow of value across complex systems.


  • AJ

    February 16, 2013 at 1:12 pm

    What if i have to get the number of like from a page that is not on Facebook.

    For eg. I have a like button for a page on my website and i want to grab the number of likes of that page. How can that be done?

  • garima

    March 7, 2017 at 10:33 am

    when i run the file it says facebbok class not found

  • ravi parmar

    April 14, 2017 at 9:19 am

    git clone not available on github
    please provide file


Leave a reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.