卷曲错误35 - 在连接api.rkd.reuters.com:443未知的SSL协议错误 [英] cURL error 35 - Unknown SSL protocol error in connection to api.rkd.reuters.com:443

查看:301
本文介绍了卷曲错误35 - 在连接api.rkd.reuters.com:443未知的SSL协议错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

从开发机(MAC)是没有问题的,通过卷曲在PHP连接到这一点,但在Ubuntu中,我得到这个错误。我试过在本地计算机和亚马逊AWS实例。我一派和一派,不断推出高达砖墙。有没有适当的防火墙的限制,它的一个未解之谜。 PHP5卷曲安装在Ubuntu的,我根本没有任何想法。我跑这个命令:

From development machine (mac) there is no problem connecting via cURL in PHP to this, but in Ubuntu, I get this error. I've tried on a local machine and on an Amazon AWS instance. I've googled and googled and keep coming up to brick walls. There's no firewall restrictions in place, its a complete mystery. php5-curl IS installed in ubuntu, I just don't have any ideas. I ran this command:

curl -v https://api.rkd.reuters.com/api/2006/05/01/TokenManagement_1.svc/Anonymous

和得到这个输出,没有任何线索来解决。 OpenSSL的也将安装。

and got this output, no clues whatsoever to a solution. OpenSSL is also installed.

* About to connect() to api.rkd.reuters.com port 443 (#0)
*   Trying 159.220.40.240... connected
* successfully set certificate verify locations:
*   CAfile: none
  CApath: /etc/ssl/certs
* SSLv3, TLS handshake, Client hello (1):
* Unknown SSL protocol error in connection to api.rkd.reuters.com:443 
* Closing connection #0
curl: (35) Unknown SSL protocol error in connection to api.rkd.reuters.com:443

欢迎任何对此的想法

Any ideas welcomed on this

推荐答案

我有同样的问题,遗憾的是与主机不愿意升级到PHP 5.5。

I had the same problem, unfortunately with a host unwilling to upgrade to php 5.5.

我通过创建一个新的类扩展PHP的SoapClient的使用卷曲解决了这个问题:

I solved it by creating a new class extending php's SoapClient to use cURL:

/**
 * New SoapClient class.
 * This extends php's SoapClient,
 * overriding __doRequest to use cURL to send the SOAP request.
 */
class SoapClientCurl extends SoapClient {

  public function __doRequest($request, $location, $action, $version, $one_way = NULL) {
$soap_request = $request;
$header = array(
  'Content-type: application/soap+xml; charset=utf-8',
  "Accept: text/xml",
  "Cache-Control: no-cache",
  "Pragma: no-cache",
  "SOAPAction: \"$action\"",
  "Content-length: " . strlen($soap_request),
);
$soap_do = curl_init();
$url = $location;
$options = array(
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_HEADER => FALSE,
  //CURLOPT_FOLLOWLOCATION => true,
  CURLOPT_SSL_VERIFYHOST => 0,
  CURLOPT_SSL_VERIFYPEER => FALSE,
  CURLOPT_RETURNTRANSFER => TRUE,
  //CURLOPT_USERAGENT => 'Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0)',
  CURLOPT_VERBOSE => true,
  CURLOPT_POST => TRUE,
  CURLOPT_URL => $url,
  CURLOPT_POSTFIELDS => $soap_request,
  CURLOPT_HTTPHEADER => $header,
  CURLOPT_FAILONERROR => TRUE,
  CURLOPT_SSLVERSION => 3,
);

curl_setopt_array($soap_do, $options);
$output = curl_exec($soap_do);
if ($output === FALSE) {
  $err = 'Curl error: ' . curl_error($soap_do);
}
else {
  ///Operation completed successfully
}
curl_close($soap_do);

// Uncomment the following line to let the parent handle the request.
//return parent::__doRequest($request, $location, $action, $version);
return $output;
  }

}

这篇关于卷曲错误35 - 在连接api.rkd.reuters.com:443未知的SSL协议错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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