【发布时间】:2016-05-09 03:27:49
【问题描述】:
我正在尝试连接到 Paypal 的沙盒服务器。为此,我使用了 JMSPaymentCoreBundle 和 JMSPaypalCoreBundle。
但是当我尝试连接时抛出异常:error:14077410:SSL routines:SSL23_GET_SERVER_HELLO:sslv3 alert handshake failure
我的 Symfony 版本是 2.7.9。我的 curl 版本是 7.43.0,OpenSSL 版本是 1.0.2f。
我在互联网上寻找答案,现在 cURL 请求使用 TLS 1.2 以使用 PayPal 沙箱。所以我补充说:
curl_setopt($curl, CURLOPT_SSLVERSION,6);(这是 TLS 1.2)
在vendor/jms/payment-paypal-bundle/JMS/Payment/PaypalBundle/Client/Client.php
但现在我收到以下错误:cURL Error: Unsupported SSL protocol version
感谢您的帮助! (对不起我的英语)
编辑:所以错误似乎来自以下部分
在我的控制器中:
$instruction = $reservation->getPaymentInstruction();
if (null === $pendingTransaction = $instruction->getPendingTransaction()) {
$payment = $this->ppc->createPayment($instruction->getId(), $instruction->getAmount() - $instruction->getDepositedAmount());
} else {
$payment = $pendingTransaction->getPayment();
}
$result = $this->ppc->approveAndDeposit($payment->getId(), $payment->getTargetAmount());
if (Result::STATUS_PENDING === $result->getStatus()) {
$ex = $result->getPluginException();
if ($ex instanceof ActionRequiredException) {
$action = $ex->getAction();
if ($action instanceof VisitUrl) {
return $this->redirect($action->getUrl());
}
throw $ex;
}
} else if (Result::STATUS_SUCCESS !== $result->getStatus()) {
throw new \RuntimeException('Transaction was not successful: '.$result->getReasonCode());
}
在我的供应商中:(vendor/jms/payment-paypal-bundle/JMS/Payment/PaypalBundle/Client/Client.php)
public function request(Request $request)
{
if (!extension_loaded('curl')) {
throw new \RuntimeException('The cURL extension must be loaded.');
}
$curl = curl_init();
curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, false);
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt_array($curl, $this->curlOptions);
curl_setopt($curl, CURLOPT_URL, $request->getUri());
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl, CURLOPT_HEADER, true);
// Try but did not worl: curl_setopt($curl, CURLOPT_SSL_CIPHER_LIST, 'TLSv1');
curl_setopt($curl, CURLOPT_SSLVERSION,6); // What i also add but error with my SSL protocol version not supported
etc.
当我在 Client.php 中添加curl_setopt($curl, CURLOPT_SSLVERSION,6); I'v got that
并且 when I don't
【问题讨论】:
-
您能否发布您在代码中遇到问题的位置?
标签: php symfony ssl curl paypal