CURL Error 35 - Unknown SSL protocol error due to api.rkd.reuters.com-00-0043

From the development machine (mac) there is no problem connecting via cURL in PHP to this, but on Ubuntu I get this error. I tried on the local machine and on the Amazon AWS instance. I googled and googled and keep coming to the brick walls. There are no restrictions on the firewall, this is a complete secret. php5-curl IS is installed in ubuntu, I just have no ideas. I ran this command:

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

and got this result, no indication of 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 in this

+6
source share
4 answers

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

I solved this by creating a new class extending php SoapClient to use cURL:

 /** * New SoapClient class. * This extends php 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; } } 
0
source

I had this problem and fixed it by installing curl SSL version to version 3

 curl_setopt($ch, CURLOPT_SSLVERSION,3); 

Obviously, the server began to require SSL version 3, and this parameter made cURL with SSL start working again.

+6
source

Fixed! This is a known issue with Ubuntu 12.04

These instructions

http://willbradley.name/2012/10/workaround-for-php-error-in-ubuntu-12-04-soapclient-ssl-crypto-enabling-timeout/

- Undo this, it just turned off the exceptions, it still doesn't work! HELP!

- EDIT - HERES HOW I DID IT AT THE END!

I upgraded to PHP 5.5 from 5.4.3 and set the following parameters in my call that fixed it:

 $options = array('ssl_method' => SOAP_SSL_METHOD_SSLv3,'soap_version' => SOAP_1_2); $sc = new SoapClient('https://my-url.com/call/', $options); 

The update was necessary because the constant SOAP_SSL_METHOD_SSLv3 is not available in PHP versions <5.5, and, unfortunately, the Ubuntu server at that time allowed updating to 5.4.3 via apt-get update php5. I manually installed a later version and now it works fine.

+1
source

Error: CURL error: 35 - OpenSSL SSL_connect: SSL_ERROR_SYSCALL due to httpapi.com:443 (IP: 162.xxx and 204.xxx)

Inca WHMCS:

You can contact your host to assign an IP address at the end to use their API.

-1
source

Source: https://habr.com/ru/post/955991/


All Articles