Recently, a service I am hosting on GoDaddy (Economy Windows Hosting) has started being refused cURL connections to the PayPal API endpoint: https://api.sandbox.paypal.com/v1/oauth2/token
With error:
error:14077410:SSL routines:SSL23_GET_SERVER_HELLO:sslv3 alert handshake failure
Reading: Paypal can not connect to Sandbox server. Return error 14077410 (sslv3 alert handshake failure)
I understand that this is related to TLS1.2 being required. This is included in OpenSSL 1.01, but my server is currently running 0.9.8y and, as it's a shared hosting, I have no control over it.
So - does anybody know any way around this?
My code:
url_setopt($ch, CURLOPT_URL, "https://api.sandbox.paypal.com/v1/oauth2/token");
curl_setopt($ch, CURLOPT_HEADER, false);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_USERPWD, $clientId . ":" . $secret);
curl_setopt($ch, CURLOPT_POSTFIELDS, "grant_type=client_credentials");
curl_setopt($ch, CURLOPT_SSLVERSION,6);
$result = curl_exec($ch);
if (empty($result)) die("Error: No response.<br /> <b>Err:</b> " . curl_error($ch).' <b><br />ErrNo:</b> '.curl_errno($ch)."<br/>".phpinfo());
else {
$json = json_decode($result);
//print_r($json->access_token);
}