I have a problem with CURL.
When I run the code below, exception: "CURL: SSL certificate problem: unable to get local issuer certificate" is thrown. The cacert.pem is from https://curl.haxx.se/ca/cacert.pem.
protected static function curlHttpPost($url, $data) {
$ch = curl_init($url);
$verifyFile = Yii::getAlias('@common') . '/curl/cacert.pem';
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($data));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
if(file_exists($verifyFile))
{
curl_setopt($ch, CURLOPT_CAINFO, $verifyFile);
}
$response = curl_exec($ch);
$curlError = curl_error($ch);
if($curlError)
{
throw new Exception($curlError);
}
curl_close($ch);
return $response;
}