2016-08-25 18 views

答えて

0

この下のコードを使用してください。 ウェブサイトのアプリIDを作成し、通話ページのURLを送信すると、共有数が返されます。 検索データフォームにcurlライブラリを使用できます。

$ json_string = file_get_contents_curl( "https://graph.facebook.com/v2.7/?id=http://example.com/xyz/&access_token=123456789002599|abcdSXS_PJNQ5iEBH098_ABC");

$ json = json_decode($ json_string、true);

エコー$のJSON [ '共有'] [ 'share_count']

カールコードprivate function file_get_contents_curl($url) { $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_USERAGENT, $_SERVER['HTTP_USER_AGENT']); curl_setopt($ch, CURLOPT_FAILONERROR, 1); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_TIMEOUT, 300); $cont = curl_exec($ch); if (curl_error($ch)) { return false; } return $cont; }

関連する問題