/** * curl 获取 https 请求 get * @param type $url * @return type */ function curl_https_get($url) { $curl = curl_init(); curl_setopt($curl, CURLOPT_URL, $url); curl_setopt($curl, CURLOPT_HEADER, 1); curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false); //这个是重点。 curl_setopt($curl, CURLOPT_HTTPHEADER, array('Expect:')); //避免数据过长问题 curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1); curl_setopt($curl, CURLOPT_HEADER, false); //返回头信息 true返回 false不返回 $result = curl_exec($curl); curl_close($curl); return $result; }
关键字词: