CURL SSL connection (PHP) working with Linux, code failure on Windows

I wrote a script that uses the WSDL service of our banks using Nusoap . Requests are signed with a certificate. This script works fine on Ubuntu, Apache 2.2, PHP 5.4.

When trying to achieve the same thing on Windows 7 (64-bit, Apache 2.2, PHP 5.4), I get this error caused by Curl:

**SSL read: error:140940E5:SSL routines:SSL3_READ_BYTES:ssl handshake failure, errno 0** 

I disabled the firewall and antivirus. I can provide details of Curl options or any other code or information. Thanks!

DECISION:

curl_setopt ($ this-> ch, CURLOPT_SSLVERSION, 3);

+4
source share
2 answers

To work with SSL connections, you must enable php_openssl.dll in php.ini

And when you work with curl, the common problem is that the openssl module is working with the wrong version of SSL by default. In most cases, you should set the SSL version to 3.

 curl_setopt($curl, CURLOPT_SSLVERSION,3); 

I had the same problem for several days.

+3
source

If you are using nfephp-org lib on a Linux based server, you can use this code for the ssl change protocol:

 $nfe = new ToolsNFe(MY_CONFIG_PATH); $nfe->setSSLProtocol('SSLv3'); 

When MY_CONFIG_PATH is the path to your configuration file.

Se você está tentando usar o nfephp-org e está com esse erro em servidores linux, mude o protocolo ssl, como no código acima.

0
source

All Articles