Create a gist now

Instantly share code, notes, and snippets.

Embed
Count shows shares + likes
<?php
namespace Heise\Shariff\Backend;
class Facebook extends Request implements ServiceInterface
{
public function getName()
{
return 'facebook';
}
public function getRequest($url)
{
$facebookURL = 'https://api.facebook.com/method/fql.query';
$facebookURL .= '?format=json';
$facebookURL .= '&query=select share_count,like_count from link_stat where url="' . $url . '"';
return $this->createRequest($facebookURL);
}
public function extractCount($data)
{
return (int)$data[0]['share_count'] + (int)$data[0]['like_count'];
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment