FacebookのAPIを通じてシェア数の取得を試みています。
下記のようにしていますが、シェア数の取得が出来ません。
同じURLを確認用サービスにかけたのですが、89件ほどのカウントがあります。
https://developers.facebook.com/tools/debug/sharing/?q=http%3A%2F%2Fwww.futago-jitensya.jp%2Fevent_detail%2F83
public function index(){ $url = "http://graph.facebook.com/?id=".rawurlencode("http://www.hogehoge.jp/detail/79"); echo "url".$url."<br />"; $json = @file_get_contents('http://graph.facebook.com/?id='.rawurlencode($url)); echo "json".$json."<br />"; $array = json_decode($json,true); if(!isset($array['share']['share_count'])){ $count = 0; }else{ $count = $array['share']['share_count']; } $fb_count = $count; }
echo でjsonデータが取得出来ていないことが判明しています。
PHP はcodeigniter というフレームワークを利用しています。
どのように対処すればよいでしょうか?
宜しくお願いいたします。
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。