【发布时间】:2016-07-01 11:04:19
【问题描述】:
最近,我在 GoDaddy(经济 Windows 托管)上托管的一项服务开始被拒绝与 PayPal API 端点的 cURL 连接:https://api.sandbox.paypal.com/v1/oauth2/token
有错误:
error:14077410:SSL routines:SSL23_GET_SERVER_HELLO:sslv3 alert handshake failure
阅读:Paypal can not connect to Sandbox server. Return error 14077410 (sslv3 alert handshake failure)
我了解这与需要 TLS1.2 有关。这包含在 OpenSSL 1.01 中,但我的服务器当前运行的是 0.9.8y,并且由于它是共享主机,我无法控制它。
那么 - 有人知道解决这个问题的方法吗?
我的代码:
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);
}
【问题讨论】:
-
解决此问题的唯一方法是更新您的服务器软件堆栈。如果 GoDaddy 不会在您现有的服务器上为您执行此操作,那么您将需要迁移到新服务器。
-
远离老爹