How to get Facebook page fan count using PHP ?

It’s pretty easy to obtain the like count via Facebook’s Graph Api.This small code snippet given below uses FaceBook’s graph api and returns the likes count of the page. There is no need to have the FaceBook access token to call the api and get the result.you will receive result as a JSON object and you can extract the number of likes from it.

Simple Function to Get Facebook Page fan Count

How to use Above function

In order use getPageFanCount() function you have to pass page id as parameter as shown below

That’s it.

I hope you like this Post, Please feel free to comment below, your suggestion and problems if you face - we are here to solve your problems.

0 0 vote
Article Rating
Subscribe
Notify of
guest
6 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
Salman Iqbal
Salman Iqbal
2 years ago

it’s not accessing my page how to give accurate Facebook page name. “page is not a valid FB Page”

arjun
2 years ago
Reply to  Salman Iqbal

Let me try, What is your page name?

Salman Iqbal
Salman Iqbal
2 years ago
Reply to  arjun
Khalil
Khalil
2 years ago

Hi, it shows “page is not a valid FB Page”, can you please help me to make it works

Naresh Chandragiri
Naresh Chandragiri
2 years ago

Hi.. I tried with your code but i am getting error like (#803) Cannot query users by their username (naresh.chandragiri)”, Can you please suggest what value we need to give in $page

arjun
2 years ago
DMCA.com Protection Status
6
0
Would love your thoughts, please comment.x
()
x