Itt egy kis egyszerű függvény, amivel lekérhetjük a Facebooktól, hogy az adott linket hányan lájkolták.
function get_fb_link_stat($url){
$ret = array();
$ctx = stream_context_create(array('http'=>array('timeout'=>1)));
$html = @file_get_contents('https://api.facebook.com/method/fql.query?query='.urlencode('select like_count, total_count, share_count, click_count from link_stat where url="'.$url.'"'),0,$ctx);
if (!$html) return false;
if(preg_match('!<error_code>[^<>]+</error_code>!',$html)) return false;
preg_match_all('!<([^<>]+)>([0-9]+)</\\1>!',$html,$ide);
foreach ($ide[1] as $key => $value) $ret[$value] = $ide[2][$key];
return $ret;
}
Eredménye:
Array
(
[like_count] => 112
[total_count] => 222
[share_count] => 72
[click_count] => 0
)