Blogger Information
Blog 142
fans 5
comment 0
visits 130007
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
PHP curl 访问https URL 武汉
php开发大牛
Original
733 people have browsed it

需开启open_ssl扩展

function curl_string ($url,$user_agent,$proxy){

$ch = curl_init();
curl_setopt ($ch, CURLOPT_PROXY, $proxy);
curl_setopt ($ch, CURLOPT_URL, $url);
curl_setopt ($ch, CURLOPT_AUTOREFERER, true);
curl_setopt ($ch, CURLOPT_SSL_VERIFYPEER, true);
curl_setopt ($ch, CURLOPT_FOLLOWLOCATION, true);
curl_setopt ($ch, CURLOPT_USERAGENT, $user_agent);
curl_setopt ($ch, CURLOPT_COOKIEJAR, "c:\\cookie.txt");
curl_setopt ($ch, CURLOPT_HEADER, 1);curl_setopt ($ch, CURLOPT_SSL_VERIFYHOST, 1);
curl_setopt ($ch, CURLOPT_SSL_VERIFYPEER, FALSE); curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt ($ch, CURLOPT_TIMEOUT, 320);
$result = curl_exec ($ch);
curl_close($ch);
return $result;
}

$url_page = "https://www.google.com.hk/?gws_rd=cr";
//$url_page = "https://github.com/";
$user_agent = "Mozilla/4.0";
$proxy = "https://127.0.0.1:8087";
$string = curl_string($url_page,$user_agent,$proxy);
echo($string);// $string;
var_dump($string);
//echo file_get_contents("$url_page");
exit;


Statement of this Website
The copyright of this blog article belongs to the blogger. Please specify the address when reprinting! If there is any infringement or violation of the law, please contact admin@php.cn Report processing!
All comments Speak rationally on civilized internet, please comply with News Comment Service Agreement
0 comments
Author's latest blog post