Rumah > Soal Jawab > teks badan
利用curl发get请求时,url后边不能带有查询字符串吗??????为啥带上就访问不到页面呢??
黄舟2017-04-11 10:23:14
//必须把$_GET的信息拼接好放到url里面去
function httpGet($url) {
$curl = curl_init();
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl, CURLOPT_TIMEOUT, 500);
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, false);
curl_setopt($curl, CURLOPT_URL, $url);
$res = curl_exec($curl);
curl_close($curl);
return $res;
}