php (35) javascript (31) phpjavascript (30) jquery (23) html (20) mysql (14) database (9) codeigniter (4) json (4) bar chart (2) calendar (2) column chart (2) framework (2) google maps (2) query (2) tables (2) url (2) dropdown (1)

Friday, January 19, 2018

Find Number of Likes on Your Facebook Page with PHP

PHP code to find the number of likes on your facebook page.

Go to

Login with your Facebook username and password

Create an app from that you will get App ID and App Secret.

Use both of them in the program.

PHP Code 


function Facebook_Page_Likes($id, $appid, $appsecret)
    $json_url = '' . $id . '?access_token=' . $appid . '|' . $appsecret . '&fields=fan_count';
    $json = file_get_contents($json_url);

    $json_output = json_decode($json);

    if ($json_output->fan_count) {
        return $fan_count = $json_output->fan_count;
    } else {
        return 0;

Facebook_Page_Likes('XXXXX', 'APPID', 'APPSECRET');



  1. It’s really a cool and helpful piece of information. I’m glad that you shared this useful info with us. Please keep us up to date like this. Thanks for

  2. Thanks for sharing such an awesome post. This is very informative and helpful, share more post like. Digital Signature Certificate

  3. Thanks for sharing the relevant information with us…It are good for us. Digital Signature Certificate

  4. I really appreciate this wonderful post that you have provided for us. I assure this would be beneficial for most of the people. Class 2 Digital Signature Certificate

  5. The carpet cleaning company in Riyadh has the most skilled and experienced workers in the field of carpet cleaning in the Kingdom, and our workers are trained at the highest level in the different ways of dealing and cleaning with different types of fabrics made of textiles and carpet.
    شركة تنظيف شقق بمكة
    شركة تنظيف بيوت بمكة
    شركة نقل عفش بمكة
    شركة مكافحة حشرات


More Posts