本文实例讲述了php使用curl打开https网站的方法。分享给大家供大家参考。具体实现方法如下:
?
1
2
3
4
5
6
7
8
9
10
11$url = 'https://www.google.com.hk';
$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;
希望本文所述对大家的php程序设计有所帮助。
http://www.bkjia.com/phpjc/1017845.htmlwww.bkjia.comtruehttp://www.bkjia.com/phpjc/1017845.htmltecharticlephp使用curl打开https网站的方法 这篇文章主要介绍了php使用curl打开https网站的方法,涉及php使用curl连接网站及获取信息的相关技巧,需要的朋友...
