Unable to get local issuer certificate using CURL

こ雲淡風輕ζ 提交于 2021-01-29 04:07:05

问题


I'm getting the following error when call the CURL with https url:

"SSL certificate problem: unable to get local issuer certificate"

    $ch = curl_init($sendurl);                                                                                                                                     
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); 
    curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, true);  

    curl_setopt($ch, CURLOPT_CAINFO, dirname(__FILE__) .'/cert/uat.abc.pem');

    echo $result = curl_exec($ch);
    echo curl_error($ch);

Does anyone know how to set it up?


回答1:


I think you can set CURLOPT_SSLCERT option to fix it,or use curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 1) and curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false) to ignore this warming



来源:https://stackoverflow.com/questions/32264938/unable-to-get-local-issuer-certificate-using-curl

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!