2016-08-25 24 views

回答

0

请使用下列代码。 为您的网站创建应用程序ID并调用共享页面URL,它将返回份额计数。 您可以使用卷曲库检索数据表格Facebook

$ 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; }

相关问题