Obtain Facebook likes via PHP SDK
In an update to this post here is another way to obtain the number of likes for a Facebook page.
I’ll assume that you’ve already registered a Facebook application, have downloaded the PHP SDK and have included for use in your code.
require('facebook.php');
Setup an array with your Facebook applications credentials
$facebook = new Facebook(array(
'appId' => '000000000', // Put appID here
'secret' => '0000c000c000c000c', // Put your secret key here
));
Decide which page you wish to obtain the number of likes for
$getRequest = $facebook->api('/cocacola'); // Lets look at the Facebook page for the popular soft drink
echo $getRequests['likes'];
Obviously you can consume, contrast and display this information in more exciting ways than simply echoing it to the screen. Enjoy.
Obtain Facebook likes via PHP SDK Read More »