angular.callbacks到PHP的字符串?

时间:2018-06-11 19:09:44

标签: php mysql json angular curl

我有来自angular的数据表,我想将其转换为sting以放入表sql数据库......

网址='http://lscluster.hockeytech.com/feed/index.php?feed=statviewfeed&view=players&season=60&team=all&position=skaters&rookies=0&statsType=expanded&rosterstatus=undefined&site_id=1&first=0&limit=1185&sort=points&league_id=4&lang=en&division=-1&key=50c2cd9b5e18e390&client_code=ahl&league_id=4&callback=angular.callbacks._q'

使用该代码的Normaly我能够解析所有内容,但它为该URL返回零...

$curl_handle=curl_init();
curl_setopt($curl_handle, CURLOPT_URL, $URL);
curl_setopt($curl_handle, CURLOPT_CONNECTTIMEOUT, 2);
curl_setopt($curl_handle, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($curl_handle, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/46.0.2490.80 Safari/537.36');
$querymain = curl_exec($curl_handle);
curl_close($curl_handle);

$arr = json_decode((string)$querymain, true);
(json_last_error()); // call after json_decode
$numarr = count($arr['data']);

感谢您的提示。

0 个答案:

没有答案