cURL / Mailing Lists / curl-and-php / Single Mail

curl-and-php

Websphere HTTPS command line connection ok, PHP exec connection ok, but PHP-CURL library (curl_exec) error

From: Javi Signes <fjsignes_at_computerxabia.com>
Date: Tue, 18 Oct 2005 18:44:17 +0200

Hi,
    Operation System: Windows XP SP1
    I am trying to connect to a webserver Websphere in a secure mode
(HTTPS).
    When i try the following by command line:
       curl.exe -k https://websphereserver:9084/SOAP
     I can connect to the server.
     In a PHP script executing then comand "exec" like this:
     <?php
             ....
             $curl = "path_to_curl\curl.exe";
             $_url="https://websphereserver:9084/SOAP";
             $data="something";
             exec("$curl -k --verbose -d \"$data\" $_url", $result);
             print_r($result);
      ?>
     I can connect to the server too.

    But when i try to use libcurl library in php script:
     <?php

   $defined_vars = get_defined_vars();

   $_url = 'https://websphereserver:9084/SOAP';

   $ch = curl_init();
   curl_setopt($ch, CURLOPT_VERBOSE, 1);
   curl_setopt($ch,CURLOPT_SSLVERSION,2);
   curl_setopt($ch, CURLOPT_URL,$_url);
   curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
   curl_setopt($ch, CURLOPT_USERAGENT, $defined_vars['HTTP_USER_AGENT']);
   curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
   $result=curl_exec ($ch);
        $cErr = curl_error($ch);
        if ($cErr != '') {
            $err = 'cURL ERROR: '.curl_errno($ch).': '.$cErr.'<br>';
            foreach(curl_getinfo($ch) as $k => $v){
                $err .= "$k: $v<br>";
            }
            echo("Error $err");
            curl_close($ch);
            return false;
        } else {
            echo '<pre>';
            var_dump(curl_getinfo($ch));
            echo '</pre>';
            echo $data;
        }
   curl_close ($ch);

   echo("Output: ".$result);

?>
   I get the next error:
    Error cURL ERROR: 35: SSL: error:00000000:lib(0):func(0):reason(0)
    So, i thought that the SSL version put in the line:
           curl_setopt($ch,CURLOPT_SSLVERSION,2);
    was wrong, because if i put in the command line:
        curl.exe -2 -k https://websphereserver:9084/SOAP
     I got an error saying that curl: (35) Unknown SSL protocol error in
connection to https://websphereserver:9084/SOAP
     So i try to comment that line:
         // curl_setopt($ch,CURLOPT_SSLVERSION,2);
      and so the curl must try to connect with SSLV2 or SSLV3, but i
receive the next error:
      Error cURL ERROR: 35: SSL: error:140770FC:SSL
routines:SSL23_GET_SERVER_HELLO:unknown protocol
      But who i know that the server user SSLv3 because executing in the
command line:

        curl.exe -3 -k https://websphereserver:9084/SOAP

      it is working ok, i put uncomment the next line and force to use
SSLV3:

           curl_setopt($ch,CURLOPT_SSLVERSION,3);

       But i receive in PHP the next error:

       Error cURL ERROR: 35: SSL: error:1408F10B:SSL
routines:SSL3_GET_RECORD:wrong version number

       So i am thinking there is a bug in the php library that envolves
the Curl options to connect to Websphere servers in HTTTPS connection.
        Any ideas? Any suggestions?
        Can anybody help me?
        Do you think if this is a really bug?
        Who can i solve this problem? (I don't want to use php exec
command because i use NuSoap to envolve SOAP protocol)
       Do you know any special character that i need to disable (like
*CURLOPT_CRLF in FTP protocol) to establish th connection with this
websphere server?
    I'll be waiting for some reply and help.

    Thanks.
*
    Note:
    1)if i change the url to $_url = 'https://www.paypal.com'; It is
working fine with PHP-Curl library, so i think that this is only problem
with SSL protocol to establish connection with WebSphere Servers.

   2)PHP versions ckecked:
    PHP-5.0.5Win32 -libcurl/7.14.0 OpenSSL/0.9.8 zlib/1.2.3- or
    PHP-4.4.0Win32 -libcurl/7.11.2 OpenSSL/0.9.8 zlib/1.1.4 - or
    PHP-5.1.0RC1-Win32 -libcurl/7.14.0 OpenSSL/0.9.8 zlib/1.2.3-
    In all of them shows me the same error.
_______________________________________________
http://cool.haxx.se/cgi-bin/mailman/listinfo/curl-and-php
Received on 2005-10-18