本文主要是介绍使用curl访问报错:cURL error 60: SSL certificate problem: unable to get local issuer certificate,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
报错:
解决方式:
$ch = curl_init();curl_setopt($ch, CURLOPT_URL, $url);curl_setopt($ch, CURLOPT_POST, 1);curl_setopt($ch, CURLOPT_HEADER, 0);curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);//设置为不是https也可以访问curl_setopt ($ch, CURLOPT_SSL_VERIFYHOST,0);curl_setopt ($ch, CURLOPT_SSL_VERIFYPEER,0);$result = curl_exec($ch);curl_close($ch);$ret = json_decode($result);return $ret;
主要添加的代码:
//设置为不是https也可以访问curl_setopt ($ch, CURLOPT_SSL_VERIFYHOST,0);curl_setopt ($ch, CURLOPT_SSL_VERIFYPEER,0);
注意:开启curl扩展和OpenSSL扩展
这篇关于使用curl访问报错:cURL error 60: SSL certificate problem: unable to get local issuer certificate的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!