A colleague today reflected that an error was reported when using curl to initiate an HTTPS request: "SSL certificate problem, verify that CA cert is OK." Details:error:14090086:ssl routines:SSL3_GET_SERVER_CERTIFICATE:certificate Verify Failed "
Obviously, there was a problem validating the certificate.
There are 2 ways to use curl if the HTTPS request you want to initiate is normal:
Method one, set to not verify the certificate and host.
Before executing curl_exec (). SET option
Copy Code code as follows:
$ch = Curl_init ();
......
curl_setopt ($ch, Curlopt_ssl_verifypeer, FALSE);
curl_setopt ($ch, Curlopt_ssl_verifyhost, FALSE);
Method Two, set up a correct certificate.
The local SSL discriminant certificate is too old, causing the link to error the SSL certificate is incorrect.
We need to download a new SSL local discriminant file
Http://curl.haxx.se/ca/cacert.pem
Put it in the program file directory
Curl Add the following configuration
Copy Code code as follows:
curl_setopt ($ch, curlopt_ssl_verifypeer,true);
curl_setopt ($ch, Curlopt_cainfo,dirname (__file__). /cacert.pem ');
Done
(I have failed to verify ...) The error message is: SSL certificate problem, verify this CA cert is OK. Details:error:14090086:ssl routines:SSL3_GET_SERVER_CERTIFICATE:certificate Verify failed)
If you are interested in this, you can refer to a great foreign God article. http://unitstep.net/blog/2009/05/05/using-curl-in-php-to-access-https-ssltls-protected-sites/