URLを指定してFacebookのいいね!数を取得する
備忘録(適当)
//Document is here -> http://developers.facebook.com/docs/reference/fql/link_stat //httpsを扱うときはOpenSSLが有効になっていることを確認してね、未来の僕! $url = "http://www.facebook.com/"; $result = getFacebookLikeCount($url); function getFacebookLikeCount($url){ $req = "http://api.facebook.com/method/fql.query?query=select%20%20like_count%20from%20link_stat%20where%20url=%22".$url."%22"; //XMLをパース,オブジェクト取得 $xml = simplexml_load_file($req) or die("XML parse error"); $arr = get_object_vars($xml); return $arr["link_stat"]->like_count; }