跳过证书验证
注:以淘宝网站为例。
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://www.taobao.com/",// HTTPS的网址
CURLOPT_RETURNTRANSFER => true,// 返回字串
CURLOPT_SSL_VERIFYPEER => 0,// 跳过证书验证
));
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}