How to get Facebook share count for url

I used this script to grab google plus and facebook shares:

<?
class share {
private $url,$timeout;
function __construct($url,$timeout=10) {
$this->url=rawurlencode($url);
$this->timeout=$timeout;
}
function get_fb() {
$json_string = $this->file_get_contents_curl('http://api.facebook.com/restserver.php?method=links.getStats&format=json&urls='.$url);
$json = json_decode($json_string, true);
return isset($json[0]['share_count'])?intval($json[0]['share_count']):0;
}
function get_gp() […]

See original post by invalid@example.com (abyse)

Leave a Reply