1. 程式人生 > >curl如何獲取https中的內容

curl如何獲取https中的內容

$ch = curl_init();
$url = 'https://www.kanjian.com';
curl_setopt($ch, CURLOPT_URL, $url);

curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);

//主要是加上下面的兩個,,據說不安全哦

curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, FALSE);

$res = curl_exec($ch);

curl_close($ch);
var_dump($res);