Curl https 访问
2015-05-08 02:52 youxin 阅读(896) 评论(0) 编辑 收藏 举报如果访问https的网页,出现:
curl: (60) SSL certificate problem: unable to get local issuer certificate
将
将 CURLOPT_SSL_VERIFYPEER 设置为 false,
将 CURLOPT_SSL_VERIFYHOST 设置为 false.
即可解决。
代码如下:
<?php
$cURL = curl_init();
$url = 'http://www.51-n.com/';
curl_setopt_array(
$cURL,
array(
CURLOPT_URL => $url,
CURLOPT_REFERER => $url,
CURLOPT_AUTOREFERER => true,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_SSL_VERIFYPEER => false,
CURLOPT_SSL_VERIFYHOST => false,
CURLOPT_CONNECTTIMEOUT => 1,
CURLOPT_TIMEOUT => 30,
CURLOPT_USERAGENT => 'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/34.0.1847.116 Safari/537.36'
)
);