If you are trying to do a cURL to a url on https on a windows server. You are likely to get curl error like
CURL Error 60: SSL certificate problem, verify that the CA cert is OK.
Details: error:14090086:SSL routines
SSL3_GET_SERVER_CERTIFICATE:certificate verify failed
To solve this issue you need to do following steps
- Download this .pem file from http://curl.haxx.se/docs/caextract.html
- Place this file on you web server, where you can refer it in code.
- Now add following code where you are doing the actual cURL request curl_setopt($curl, CURLOPT_CAINFO, “c:/path_to/cacert.pem”);
Please ensure that you provide correct physical path to cacert.pem file. A sample code will look like as given below
// the url to connect, note its HTTPS url
$the_url = "https://www.google.com/";
$certificate = "c:/path_to/cacert.pem";
$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, $the_url);
curl_setopt($curl, CURLOPT_CAINFO, $certificate);
// adjust these as per your need
curl_setopt($curl, CURLOPT_HEADER, 0);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
$response = curl_exec ($curl);
echo "the cURL response is: ".$response;
This should resolve the error.