php调用https

<?php

function curl_get_https($url)
{
$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, $url);
curl_setopt($curl, CURLOPT_HEADER, 0);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false); // 跳过证书检查
curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, false); // 跳过证书检查
$tmpInfo = curl_exec($curl);
curl_close($curl);
return $tmpInfo;
}

$url = "https://www.baidu.com";

$result = curl_get_https($url);

var_dump($result);