https://api.mxc.io/swap/depth?count=100&instrumentID=10
直接浏览器访问,能有数据, 但是用 file_get_contents 或者 curl 都获取不到
$ch = curl_init();
curl_setopt($ch,CURLOPT_URL, "https://api.mxc.io/swap/depth?count=100&instrumentID=10");
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch,CURLOPT_RETURNTRANSFER,1);
curl_setopt($ch,CURLOPT_HEADER,0);
curl_setopt($ch, CURLOPT_TIMEOUT,60);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, FALSE);
echo $output = curl_exec($ch);
curl_close($ch);
1
hcymk2 2020-04-09 15:34:55 +08:00
Content-Encoding: gzip
|
2
hopestar86 OP @hcymk2 curl_setopt($ch, CURLOPT_ENCODING, 'gzip'); 谢谢
|