How To Get Total Facebook Page Likes In Php


1
Listing Type
List Category
Tutorials
Location
Bur Dubai
Last update
API for getting total number of likes of a facebook page.Facebook Graph API - it just returns JSON data

http://graph.facebook.com/propertyonline.ae


Example :-1



function fblikes($username)
{
$url = 'http://graph.facebook.com/'.$username;
$ch = curl_init();
curl_setopt($ch,CURLOPT_FOLLOWLOCATION,true);
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$output = curl_exec($ch);
$result = json_decode($output);
return $result->likes;
}
echo $total = fblikes('propertyonline.ae');

?>

Example :-2

function fblikes($username)
{
$data = file_get_contents('http://graph.facebook.com/'.$username);
$result = json_decode($data);
return $result->likes;
}
echo $total = fblikes('propertyonline.ae');
Distance Education In Dubai
Dubai, United Arab Emirates

9966416345
REPLY TO THIS CLASSIFIED
7 + 2 =