I've been using altervista for a few months now for a tool that I've built. The code I've used is pretty straight-forward and it was working well. A few hours ago I've started seeing this problem when calling a callback function using curl:
SSL certificate problem: unable to get local issuer certificate
This is the code that produces the error:
Code:
//Do the initial check.
$header='Authorization: Basic '.base64_encode($client_id.':'.$secret);
$fields_string='';
$fields=array(
'grant_type' => 'authorization_code',
//Do the initial check.
$header='Authorization: Basic '.base64_encode($client_id.':'.$secret);
$fields_string='';
$fields=array(
'grant_type' => 'authorization_code',
'code' => $code
);
foreach ($fields as $key => $value) {
$fields_string .= $key.'='.$value.'&';
}
$fields_string = rtrim($fields_string, '&');
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $token_url);
curl_setopt($ch, CURLOPT_USERAGENT, $useragent);
curl_setopt($ch, CURLOPT_HTTPHEADER, array($header));
curl_setopt($ch, CURLOPT_POST, count($fields));
curl_setopt($ch, CURLOPT_POSTFIELDS, $fields_string);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, true);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2);
// While using this is optional, it may be required if you encounter
// the "SSL certificate problem: unable to get local issuer certificate"
// error when calling the API using curl.
//curl_setopt( $ch, CURLOPT_SSL_VERIFYPEER, false );
$result = curl_exec($ch);
if ($result===false) {
auth_error(curl_error($ch));
}
I've tried setting CURLOPT_SSL_VERIFYPEER to false, but even that produces the same error. Has something changed on the Altervista side to suddenly cause this?
The very same code runs well on my local server.