我試圖連接到貝寶的沙箱服務器。爲此,我使用JMSPaymentCoreBundle和JMSPaypalCoreBundle。Symfony2&PayPal - cURL錯誤:14077410:SSL(sslv3警報握手失敗)
但是,當我試圖連接異常被拋出: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
您可以發佈您的代碼中遇到問題的位置嗎? – Demitrian