<i id='HSThM'><tr id='HSThM'><dt id='HSThM'><q id='HSThM'><span id='HSThM'><b id='HSThM'><form id='HSThM'><ins id='HSThM'></ins><ul id='HSThM'></ul><sub id='HSThM'></sub></form><legend id='HSThM'></legend><bdo id='HSThM'><pre id='HSThM'><center id='HSThM'></center></pre></bdo></b><th id='HSThM'></th></span></q></dt></tr></i><div id='HSThM'><tfoot id='HSThM'></tfoot><dl id='HSThM'><fieldset id='HSThM'></fieldset></dl></div>
  • <tfoot id='HSThM'></tfoot>
      <bdo id='HSThM'></bdo><ul id='HSThM'></ul>

      <legend id='HSThM'><style id='HSThM'><dir id='HSThM'><q id='HSThM'></q></dir></style></legend>

        <small id='HSThM'></small><noframes id='HSThM'>

        将 PHP cURL 请求从 SSLv3 更新为 TLS ..?

        Update PHP cURL request from SSLv3 to TLS..?(将 PHP cURL 请求从 SSLv3 更新为 TLS ..?)

            • <bdo id='bgen6'></bdo><ul id='bgen6'></ul>
                  <tbody id='bgen6'></tbody>
              • <i id='bgen6'><tr id='bgen6'><dt id='bgen6'><q id='bgen6'><span id='bgen6'><b id='bgen6'><form id='bgen6'><ins id='bgen6'></ins><ul id='bgen6'></ul><sub id='bgen6'></sub></form><legend id='bgen6'></legend><bdo id='bgen6'><pre id='bgen6'><center id='bgen6'></center></pre></bdo></b><th id='bgen6'></th></span></q></dt></tr></i><div id='bgen6'><tfoot id='bgen6'></tfoot><dl id='bgen6'><fieldset id='bgen6'></fieldset></dl></div>
                <legend id='bgen6'><style id='bgen6'><dir id='bgen6'><q id='bgen6'></q></dir></style></legend>
                <tfoot id='bgen6'></tfoot>

                <small id='bgen6'></small><noframes id='bgen6'>

                  本文介绍了将 PHP cURL 请求从 SSLv3 更新为 TLS ..?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  由于最近在 SSLv3 中发现的漏洞,许多网络服务提供商(例如 PayPal、Facebook、Google)禁用它并希望我们改用 TLS.我在弄清楚如何执行此操作时遇到了一些麻烦.

                  我目前正在使用以下函数来处理我的 cURL 请求.

                  function CURLRequest($Request = "", $APIName = "", $APIOperation = "", $PrintHeaders = false){$curl = curl_init();curl_setopt($curl, CURLOPT_VERBOSE, 1);curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, FALSE);curl_setopt($curl, CURLOPT_TIMEOUT, 30);curl_setopt($curl, CURLOPT_URL, $this->EndPointURL);curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);curl_setopt($curl, CURLOPT_POSTFIELDS, $Request);if($this->APIMode == '证书'){curl_setopt($curl, CURLOPT_SSLCERT, $this->PathToCertKeyPEM);}$Response = curl_exec($curl);/** 如果发生 cURL 错误,则将其输出以供审核.*/if($this->Sandbox){如果(卷曲错误($卷曲)){echo curl_error($curl).'<br/><br/>';}}curl_close($curl);返回 $Response;}

                  但是,当我尝试访问 PayPal 的沙箱时,他们已经禁用了此功能,我最终遇到了 cURL 错误:error:14077410:SSLroutines:SSL23_GET_SERVER_HELLO:sslv3 alert handshake failure>

                  我发现的信息是,我只需要将其更改为使用 TLS 而不是 SSL,而我看到的其他答案说只需在我的函数中添加 curl 选项即可...

                  curl_setopt($curl, CURLOPT_SSLVERSION, CURL_SSLVERSION_TLSv1);

                  不过,我已经添加了该选项,但仍然得到完全相同的结果.任何有关我如何使这项工作发挥作用的信息都将不胜感激.谢谢!

                  解决方案

                  复制自:SSL 错误无法更改为 TLS

                  尝试将 curl_setopt($curl, CURLOPT_SSL_CIPHER_LIST, 'TLSv1'); 添加到您的代码中.

                  如果您的 cURL 基于 OpenSSL libssl,这将起作用,但如果基于 nss,则不起作用.

                  Because of the recent vulnerability discovered in SSLv3, many web service providers (ie. PayPal, Facebook, Google) are disabling that and wanting us to use TLS instead. I'm having a little bit of trouble figuring out how to do this.

                  I'm currently using the following function to handle my cURL requests.

                  function CURLRequest($Request = "", $APIName = "", $APIOperation = "", $PrintHeaders = false)
                  {
                      $curl = curl_init();
                              curl_setopt($curl, CURLOPT_VERBOSE, 1);
                              curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, FALSE);
                              curl_setopt($curl, CURLOPT_TIMEOUT, 30);
                              curl_setopt($curl, CURLOPT_URL, $this->EndPointURL);
                              curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
                              curl_setopt($curl, CURLOPT_POSTFIELDS, $Request);
                  
                      if($this->APIMode == 'Certificate')
                      {
                          curl_setopt($curl, CURLOPT_SSLCERT, $this->PathToCertKeyPEM);
                      }
                  
                      $Response = curl_exec($curl);
                  
                      /*
                       * If a cURL error occurs, output it for review.
                       */
                      if($this->Sandbox)
                      {
                          if(curl_error($curl))
                          {
                              echo curl_error($curl).'<br /><br />';  
                          }
                      }
                  
                      curl_close($curl);
                      return $Response;   
                  }
                  

                  When I try hitting PayPal's sandbox, though, where they've already disabled this, I end up with a cURL error: error:14077410:SSL routines:SSL23_GET_SERVER_HELLO:sslv3 alert handshake failure

                  The info that I've found is that I just need to change this to use TLS instead of SSL, and the other answers I've seen say to simply do that by adding a curl option to my function...

                  curl_setopt($curl, CURLOPT_SSLVERSION, CURL_SSLVERSION_TLSv1);
                  

                  I've added that option, though, and I still get the exact same result. Any information on how I can get this working would be greatly appreciated. Thanks!

                  解决方案

                  Copied from: SSL error can not change to TLS

                  Try add curl_setopt($curl, CURLOPT_SSL_CIPHER_LIST, 'TLSv1'); to your code.

                  This will work if you cURL is OpenSSL libssl based but not if nss based.

                  这篇关于将 PHP cURL 请求从 SSLv3 更新为 TLS ..?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                  相关文档推荐

                  How do I pass parameters into a PHP script through a webpage?(如何通过网页将参数传递给 PHP 脚本?)
                  PHP - include a php file and also send query parameters(PHP - 包含一个 php 文件并发送查询参数)
                  Where can I read about conditionals done with quot;?quot; and quot;:quot; (colon)?(我在哪里可以阅读有关使用“?完成的条件的信息?和“:(冒号)?)
                  Accessing arrays whitout quoting the key(在不引用键的情况下访问数组)
                  What is the name for the quot;lt;lt;lt;quot; operator?(“lt;lt;lt;的名字是什么?操作员?)
                  default as first option in switch statement?(默认为 switch 语句中的第一个选项?)

                        <small id='AugCN'></small><noframes id='AugCN'>

                      1. <i id='AugCN'><tr id='AugCN'><dt id='AugCN'><q id='AugCN'><span id='AugCN'><b id='AugCN'><form id='AugCN'><ins id='AugCN'></ins><ul id='AugCN'></ul><sub id='AugCN'></sub></form><legend id='AugCN'></legend><bdo id='AugCN'><pre id='AugCN'><center id='AugCN'></center></pre></bdo></b><th id='AugCN'></th></span></q></dt></tr></i><div id='AugCN'><tfoot id='AugCN'></tfoot><dl id='AugCN'><fieldset id='AugCN'></fieldset></dl></div>

                            <tbody id='AugCN'></tbody>

                        1. <legend id='AugCN'><style id='AugCN'><dir id='AugCN'><q id='AugCN'></q></dir></style></legend>

                            <bdo id='AugCN'></bdo><ul id='AugCN'></ul>
                            <tfoot id='AugCN'></tfoot>