【发布时间】:2016-12-12 03:48:06
【问题描述】:
$ch = curl_init();
$clientId = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx";
$secret = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx";
curl_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");
$result = curl_exec($ch);
if (curl_errno($ch)) {
echo 'Error:' . curl_error($ch);
}
curl_close ($ch);
这段代码在本地主机上工作,但是当我在我的实时服务器上进行测试时,它会给我这个错误错误:错误:14077410:SSL 例程:SSL23_GET_SERVER_HELLO:sslv3 警报握手失败然后我尝试了这个
<?php
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "https://tlstest.paypal.com/");
curl_setopt($ch, CURLOPT_CAINFO, dirname(__FILE__) . '/cacert.pem');
var_dump(curl_exec($ch));
if ($err = curl_error($ch)) {
var_dump($err);
echo "DEBUG INFORMATION:\n###########";
echo "CURL VERSION";
echo json_encode(curl_version(), JSON_PRETTY_PRINT);
}?>
github.com/paypal/TLS-update/tree/master/php 这将再次在本地主机上工作,并且在现场它给了我这个
error bool(false)
string(67) "Unknown SSL protocol error in connection to tlstest.paypal.com:443 "
DEBUG INFORMATION:
###########CURL VERSION
我的服务器有这些证书
服务器密钥和证书 #1
Subject *.secure.xxxxxxxx.com
Fingerprint SHA1: xxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Pin SHA256: S4/xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Common names *.secure.xxxxxxxx.com MISMATCH
Alternative names *.secure.xxxxxxx.com
Key RSA 2048 bits (e 65537)
Weak key (Debian) No
Issuer Symantec Class 3 Secure Server CA - G4
AIA: xxxxxxx/ss.crt
Signature algorithm SHA256withRSA
Extended Validation No
Certificate Transparency Yes (certificate)
OCSP Must Staple No
Revocation information CRL, OCSP
CRL: xxxxxx/ss.crl
OCSP: xxxxxxxxx
Revocation status Good (not revoked)
Trusted No NOT TRUSTED (Why?)
#2
Subject Symantec Class 3 Secure Server CA - G4
Fingerprint SHA1: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Pin SHA256: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Key RSA 2048 bits (e 65537)
Issuer VeriSign Class 3 Public Primary Certification Authority - G5
Signature algorithm SHA256withRSA
#3
Subject VeriSign Class 3 Public Primary Certification Authority - G5
Fingerprint SHA1: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Pin SHA256: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Key RSA 2048 bits (e 65537)
Issuer VeriSign, Inc. / Class 3 Public Primary Certification Authority
Signature algorithm SHA1withRSA WEAK
**Protocols**
TLS 1.2 Yes
TLS 1.1 Yes
TLS 1.0 Yes
SSL 3 No
SSL 2 No
检查要求at
【问题讨论】:
-
这可能是由于旧的 curl/openssl 版本。请在您的问题中添加相关版本信息。见php.net/manual/en/function.curl-version.php。
-
@SteffenUllrich curl details i.stack.imgur.com/5tPfC.png 这是 function.curl-version.php 的响应 CURL_VERSION_IPV6 不匹配 CURL_VERSION_KERBEROS4 不匹配 CURL_VERSION_SSL 匹配 CURL_VERSION_LIBZ 匹配
-
如果您真的想获得帮助,让其他人更容易帮助您:即使用正确的格式并且不要在评论内的图像中隐藏相关信息(如软件版本)。请记住:没有人需要帮助您,因此只需使用剪切+粘贴将信息作为文本输入到您的原始问题中。
标签: php ssl curl paypal server