在php中使用curl庫實現https請求,具體方法如下:
$url = 'http://www.mlszssj.com';
$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);