特定の URL のいいね数を取得しようとしています。いくつかの方法を試して検索しましたが、解決策を見つけることができませんでした...これが私が試したことです:
方法 1:
$fburl = 'http%3A%2F%2Fwww.olympusmons.com%2Fradio%2F%3Fid%3D1377';
$json_string = file_get_contents('http://api.facebook.com/restserver.php?method=links.getStats&urls=' . $url);
$json = json_decode($json_string, true);
方法 2:
$fql = "SELECT url, normalized_url, share_count, like_count, comment_count, ";
$fql .= "total_count, commentsbox_count, comments_fbid, click_count FROM ";
$fql .= "link_stat WHERE url = '".$url."'";
$apifql="https://api.facebook.com/method/fql.query?format=json&query=".urlencode($fql);
$fb_json=file_get_contents($apifql);
return json_decode($fb_json);
方法 3:
$json_string = file_get_contents('http://graph.facebook.com/?ids=' . $url);
$json = json_decode($json_string, true);
この最後の方法でその URL ( http://graph.facebook.com/?ids=http://www.olympusmons.com/radio/?id=1377 ) にアクセスすると、常に 4 が返されますが、真の値は0