拆除清運工程價格便宜,樓層搬運快速清空
不論遠近免費估價,全年無休
廣告招牌工程拆除清運工程價格便宜,樓層搬運快速清空
不論遠近免費估價,全年無休

首頁  •  j2h 論壇 • 程式設計討論     • 

[php] 取facebook 讚的值

房東:瓜瓜
發表時間:2016-01-27


$source_url = "http://www.j2h.tw"; //This could be anything URL source including stripslashes($_POST['url'])
$url = "http://api.facebook.com/restserver.php?method=links.getStats&urls=".urlencode($source_url);
$xml = file_get_contents($url);
$xml = simplexml_load_string($xml);
$shares = $xml->link_stat->share_count;
$likes = $xml->link_stat->like_count;
$comments = $xml->link_stat->comment_count;
$total = $xml->link_stat->total_count;
$max = $shares+$likes+$comments;

echo"
臉書分享. $shares 臉書按讚 $likes 臉書留言 $comments 總數 $total ";

?>









function get_facebook_likes( $url ){
$base_url = "http://graph.facebook.com/";
$obj = json_decode(file_get_contents($base_url.$url));
return isset($obj->shares) ? $obj->shares : 0;
}

echo get_facebook_likes('http://www.j2hcom.tw');
?>



  • 贊助網站       

    廣利不動產-板橋在地生根最實在--新板特區指名度最高、值得您信賴的好房仲
    完整房訊,房屋、店面熱門精選物件,廣利不動產 優質仲介,房屋租賃、買賣資訊透明,交易真安心!
    廣利不動產-新板特區指名度最高、值得您信賴的好房仲
    您的托付,廣利用心為您服務



  •  共 0 人回應

    姓名:
    佈告內容:
    其他選項: