|
- $url = '';
- $ch = curl_init($url);
- curl_setopt($ch,CURLOPT_ENCODING ,'gb2312');
- curl_setopt($ch, CURLOPT_TIMEOUT, 10);
- curl_setopt($ch, CURLOPT_FAILONERROR, false);
- curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
- curl_setopt($ch, CURLOPT_HEADER, false);
- $result = curl_exec($ch);
- curl_close($ch);
- $result = json_decode($result,true);
- print_r($result);
复制代码 重点
- curl_setopt($ch, CURLOPT_FAILONERROR, false);
- curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
- curl_setopt($ch, CURLOPT_HEADER, false);
复制代码
|
|