Subscribe For Free

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');


No comments:

Post a Comment

click it