Error: SSL peer certificate or SSH remote key was
发表于2024-03-27 10:03:03阅读2917次
Error: SSL peer certificate or SSH remote key was not OK (CURLE_SSL_PEER_CERTIFICATE): SSL certificate problem: unable to get local issuer certificate
Environment
wamp64 3.2.3
php7.3
PHP Curl Class
Issue
Getting an error "Error: SSL peer certificate or SSH remote key was not OK (CURLE_SSL_PEER_CERTIFICATE): SSL certificate problem: unable to get local issuer certificate"
$host = $this->daletou.$qishu; $host = "https://www.baidu.com"; $curl = new Curl(); $curl->setUserAgent('Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:109.0) Gecko/20100101 Firefox/109.0'); $curl->setOpt(CURLOPT_SSL_VERIFYPEER,0);//that is the key! $curl->get($host);
Resolution
不检查证书即可:CURLOPT_SSL_VERIFYPEER = 0 ;CURLOPT_SSL_HOST= 0;