Skip to content

Instantly share code, notes, and snippets.

Created Jan 9, 2015
What would you like to do?
Count shows shares + likes
namespace Heise\Shariff\Backend;
class Facebook extends Request implements ServiceInterface
public function getName()
return 'facebook';
public function getRequest($url)
$facebookURL = '';
$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