Facebook is currently one of the largest websites on the internet. It is a wise decision to have a Facebook page for your website for a number of reasons. In this tutorial, I am going to show you how to get the total number your Facebook fans (or people who like your page).
There are many ways to get the total number of your fans. However, I will show you how you can do it using Facebook PHP SDK which means we are setting up an application, and then we use the Facebook API to call for our fans number.


1. Create a Facebook page.
If you have a page already, go to step 2. To create a Facebook page, login to your account and follow this link. Choose “Brand or Page”.

2. Create a Facebook Application
If you do not have an application, learn how to create a Facebook application. You are requested to have an application on Facebook in order to have a APP ID + APP SECRET. After you get your APP ID + APP SECRET, you are ready to go to the next step.

3. Download Facebook PHP SDK From Github
This is the PHP SDK of Facebook, after you download the file. Upload it to your server because you will have to include it in your code later on. Download from here.

4. The Code!
Now that you have got your Facebook and your application, open your favorite text-editing program, such as Aptana and create a page and call it: fb_fans.php



The output of this code will be something like:
Total Fans: 351