ssl - 我的网络服务器上的 CURLOPT_SSLVERSION

标签 ssl curl paypal

我有一个使用 Paypal 付款方式的网站,当用户尝试付款时显示以下错误:

curl_error: 35
SSL connect error

我使用 curl 调用 paypal 电话:

ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $endpoint);
curl_setopt($ch, CURLOPT_VERBOSE, 0);
//curl_setopt($ch, CURLOPT_SSLVERSION, 4);
curl_setopt($ch, CURLOPT_SSLVERSION, CURL_SSLVERSION_TLSv1); 

//turning off the server and peer verification(TrustManager Concept)
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);

curl_setopt($ch, CURLOPT_CAINFO, dirname(__FILE__) . '/Certs/api_cert_chain.crt');

curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POST, 1);

$headers_array = paypal_adaptive_setupHeaders();
if (!empty($sandboxEmailAddress)) {
    $headers_array[] = "X-PAYPAL-SANDBOX-EMAIL-ADDRESS: " . $sandboxEmailAddress;
}

curl_setopt($ch, CURLOPT_HTTPHEADER, $headers_array);
curl_setopt($ch, CURLOPT_HEADER, false);

我有两个问题

1- 我该如何解决这个问题?

adding : PPHttpConfig::$DEFAULT_CURL_OPTS[CURLOPT_SSLVERSION] = 4; cause 500 server error

2- 有没有办法知道我的网络服务器上使用的 CURLOPT_SSLVERSION? (专用服务器,我可以访问所有权限来安装更新的东西......) 3- 更新 OPEN SSL 可以解决这个问题吗?

谢谢大家

最佳答案

cURL 错误 35 是 CURLE_SSL_CONNECT_ERROR,其中指出:

A problem occurred somewhere in the SSL/TLS handshake. You really want the error buffer and read the message there as it pinpoints the problem slightly more. Could be certificates (file formats, paths, permissions), passwords, and others.

鉴于 PayPal 最近所做的更改,这可能是两件事中的一件。

  1. 您的 cURL/OpenSSL 版本不支持 TLS(几个月前 PayPal 停止支持 SSLv3 及以下版本,这导致很多客户端崩溃)。由于您已禁用对等验证,这可能是问题所在。

  2. api_cert_chain.crt 不再包含 PayPal 使用的正确证书颁发机构证书。

关于ssl - 我的网络服务器上的 CURLOPT_SSLVERSION,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35917962/

相关文章:

ssl - 使用 AAACertificateServices 证书的域示例

php - paypal 不发送实时 ipn 详细信息

paypal - 我可以使用 BlueSnap 销售 PayPal 产品并在当天晚些时候收取额外费用吗?

c# - 指定用于 WSHttpBinding 客户端连接的 SSL 协议(protocol)版本

asp.net - 无法打开新的弹性 beantalk 站点 'Connection timeout'

.htaccess - 除了需要 HTTPS 的 4 个页面外,所有页面都默认为 HTTP 连接

php - 如何使用 Php cURL 中的简单上传将上传的文件移动到特定的驱动器文件夹?

git - 如何解决[curl : (60) SSL certificate problem: self signed certificate in certificate chain]

javascript - 我网页上的 PayPal 捐赠确认

paypal沙盒商户账户错误