常规curl请求:
$url = '//www.dvy.com.cn'; $curl = curl_init(); curl_setopt($curl, CURLOPT_URL,$url); curl_setopt($curl, CURLOPT_HEADER,1); curl_setopt($curl, CURLOPT_RETURNTRANSFER,1); $data = curl_exec($curl); curl_close($curl); var_dump($data);
使用curl请求HTTPS:
$url = '//www.dvy.com.cn'; $curl = curl_init(); curl_setopt($curl, CURLOPT_URL, $url); curl_setopt($curl, CURLOPT_HEADER, 1); curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1); curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);//这个是重点。 $data = curl_exec($curl); curl_close($curl); var_dump($data);