4

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

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

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

I have disabled firewall and antivirus. I can provide Curl option details, or any other piece of code or info. Thank you!

SOLUTION:

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

emanuelv
  • 73
  • 1
  • 7
  • I have the some problem using nfephp-org lib. The solution for me on linux based server is change ssl protocol: $nfe = new ToolsNFe(); $nfe->setSSLProtocol('SSLv3'); – Victor Azevedo Jan 29 '16 at 12:47

2 Answers2

3

To work with a SSL connections you have to enable the php_openssl.dll in your php.ini

And when you work with curl a common problem is that the openssl module work with a wrong SSL version as default. Most times you should set the SSL version to 3.

curl_setopt($curl, CURLOPT_SSLVERSION,3); 

I had the same problem before a few days.

René Höhle
  • 26,716
  • 22
  • 73
  • 82
0

If you are using nfephp-org lib on an linux based server you may use that code for change ssl protocol:

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

When MY_CONFIG_PATH is the path of you 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.

Victor Azevedo
  • 537
  • 4
  • 7