Braintree PHP SDK cURL 异常 [英] Braintree PHP SDK cURL exception

查看:21
本文介绍了Braintree PHP SDK cURL 异常的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我尝试使用 Braintree_ClientToken::generate() 生成客户端令牌时,我不断收到 Braintree_Exception_SSLCertificate 异常.我已经加载了 SDK,而且我的 PHP 设置似乎满足 SDK 的最低要求.

I keep getting back a Braintree_Exception_SSLCertificate exception when I try to generate a client token using Braintree_ClientToken::generate(). I've got the SDK loaded and my PHP setup seems to meet the minimum requirements for the SDK.

我运行的 PHP 和 cURL 版本是:

The versions of PHP and cURL I'm running are:

PHP 5.5.3

cURL 7.32.0OpenSSL/1.0.1e.我的 cURL 模块中启用了 SSL.

cURL 7.32.0 with OpenSSL/1.0.1e. SSL is enabled in my cURL module.

我注意到 Braintree 正在执行 TLS 1.2,所以我认为这可能是问题所在,但我尝试将以下行添加到 Braintree SDK 中的 Http.php:

I noticed Braintree is enforcing TLS 1.2 so I thought that might be the issue but I tried adding the following line to Http.php in the Braintree SDK:

curl_setopt($curl, CURLOPT_SSLVERSION, 6);

这应该将 cURL 设置为使用 TLS 1.2 但它似乎没有帮助,我不确定如何验证设置是否生效.

This should set cURL to use TLS 1.2 but it didn't seem to help and I'm not sure how to verify that the setting even took effect.

我还没有成功地向 Braintree 的 API 发出请求,所以我担心这是我做错了什么,或者我使用的 cURL 版本不好.是否有任何我遗漏的启用 SSL 所需的内容?

I haven't managed to successfully place a request to Braintree's API yet so I'm worried this is something I'm doing wrong or maybe the version of cURL I'm using is no good. Is there anything I need to enable SSL that I've missed?

谢谢,布拉德.

推荐答案

完全披露:我在 Braintree 工作.如果您有任何其他问题,请随时联系支持.

Full disclosure: I work at Braintree. If you have any further questions, feel free to contact support.

您使用的 cURL 版本可能是您的问题,因为 libcurl 版本应该大于 7.40.我建议更新到此版本,因为在该版本及更高版本中添加了 TLS 1.2 支持.

The cURL version that you are using may be your issue, because the libcurl version should be greater than 7.40. I would recommend updating to this version, since TLS 1.2 support is added at that version and beyond.

此外,此github 链接 将带您完成 Braintree 要求的流程PHP 集成与 TLS 1.2 保持同步.我之所以提到这一点,是因为您想要一种方法来检查您的 cURL 是否被设置为实例化 TLS 1.2.

Also, this github link takes you through the process that Braintree requires for your PHP integration to be up to date with TLS 1.2. I'm mentioning this since you wanted a way to check if your cURL was being set to instantiate TLS 1.2.

这样做的方法是:php -r 'echo json_encode(curl_version(), JSON_PRETTY_PRINT);'

这篇关于Braintree PHP SDK cURL 异常的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆