主页 M

php使用curl打开https网站的方法

2015-06-18 网页编程网 网页编程网
$url = 'https://www.youkud.com'; 
$ch = curl_init(); 
curl_setopt($ch, CURLOPT_URL, $url); 
curl_setopt($ch, CURLOPT_HEADER, false); 
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); 
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); 
curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.11 (KHTML, like Gecko) Chrome/23.0.1271.1 Safari/537.11'); 
$res = curl_exec($ch); 
$rescode = curl_getinfo($ch, CURLINFO_HTTP_CODE);  
curl_close($ch) ; 
echo $res;
阅读原文
阅读 3512
123 显示电脑版