$ch = curl_init();//初始化curl curl_setopt($ch,CURLOPT_URL,$url); curl_setopt($ch,CURLOPT_RETURNTRANSFER,1); curl_setopt($ch, CURLOPT_HEADER, 0); $data=curl_exec($ch); print_r(json_decode($data)); echo json_last_error_msg();//提示符号错误
用浏览器输入$url,确实反馈回来一个json数据。怎么弄?bom去头又怎么弄。好像去不掉。
回复讨论(解决方案)
.....
$data=curl_exec($ch);
echo base64_encode($data);
贴出结果
PGh0bWw+DQo8aGVhZD48dGl0bGU+MzAxIE1vdmVkIFBlcm1hbmVudGx5PC90aXRsZT48L2hlYWQ+DQo8Ym9keSBiZ2NvbG9yPSJ3aGl0ZSI+DQo8Y2VudGVyPjxoMT4zMDEgTW92ZWQgUGVybWFuZW50bHk8L2gxPjwvY2VudGVyPg0KPGhyPjxjZW50ZXI+bmdpbng8L2NlbnRlcj4NCjwvYm9keT4NCjwvaHRtbD4NCg==
加上
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);