In my PHP code I try to download a file from a URL starting with https://
$curlHandle = curl_init();
curl_setopt($curlHandle, CURLOPT_URL, $url);
curl_setopt($curlHandle, CURLOPT_RETURNTRANSFER, 1);
$response = curl_exec($curlHandle);
curl_close($curlHandle);
$response happens to be FALSE unless I do this:
curl_setopt($curlHandle, CURLOPT_SSL_VERIFYPEER, false);
before curl_exec() call.
The URL I download from is from Window Azure Blob Storage and starts with https://myaccount.blob.core.windows.net so I assume there should be no problems with the server SSL certificate.
What’s the reason for this behavior?
This happens because you have not configured curl with CA certificates that are considered trustworthy, so it has no way of verifying the signature on the remote server’s certificate (although in all likelihood the signature is valid).
To verify the signature you should set either
CURLOPT_CAINFOorCURLOPT_CAPATHappropriately.