Saturday, March 2, 2013

Get facebook page likes php

It is simple php code that get the number of users who like a particular Facebook page
<?php
/* 
Online PHP Examples with Source Code
website: http://4evertutorials.blogspot.in/
*/

$fb_URL = "http://www.facebook.com/forevertutorials"; # FB Page url
$myurl = "https://graph.facebook.com/".$fb_URL."?fields=likes";
$result = file_get_contents($myurl);
$response = json_decode($result, true);

if(count($response))
{


echo "FB Page URL: ". $fb_URL;
echo "
";
echo "FB Page ID: ". $response['id'];
echo "
";
echo "FB Page TOTAL LIKES: " .$response['likes'];
echo "
";


}



?>

No comments:

Post a Comment