<?php function curl_get_https($url) { $curl = curl_init(); //如果需要参数,设置POST参数 $post_string = array('usercode'=>'123456','password'=>'123'); curl_setopt($curl, CURLOPT_POSTFIELDS, http_build_query($post_string)); 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; //返回json对象 } $url = "https://www.baidu.com"; $result = curl_get_https($url); var_dump($result); ?>