我有一个使用 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 最近所做的更改,这可能是两件事中的一件。
您的 cURL/OpenSSL 版本不支持 TLS(几个月前 PayPal 停止支持 SSLv3 及以下版本,这导致很多客户端崩溃)。由于您已禁用对等验证,这可能是问题所在。
api_cert_chain.crt
不再包含 PayPal 使用的正确证书颁发机构证书。
关于ssl - 我的网络服务器上的 CURLOPT_SSLVERSION,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35917962/