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

curl-and-php

error using curl to connect to https server

From: Lizet P - CHIhost <lizetp_at_chihost.com>
Date: Sun, 23 Oct 2005 17:52:59 -0600

Hello all,
I'm trying to use curl to connect to a secure server. The code looks
like this:
 
$c = curl_init($url);
                echo"<br/>Showing url to be executed: ".$url."<br/>";
        curl_setopt($c, CURLOPT_SSL_VERIFYHOST, 1); //verifyhost set to
1 for expired cert
        curl_setopt($c, CURLOPT_RETURNTRANSFER, 1);
        curl_setopt($c, CURLOPT_SSL_VERIFYPEER, FALSE); // this line
makes it work under https
       curl_setopt($c,CURLOPT_SSLVERSION,2);
        $page = curl_exec($c);
        if (curl_errno($c)) {
            print curl_error($c);
        } else {
          curl_close($c);
       }
 
        echo "<br/>page result". $page;
 
 
where $url looks like
https://root:lizet34@XX.XXX.XXX.XXX/scripts/passwd?password=liz
<https://root:lizet34@xx.xxx.xxx.xxx/scripts/passwd?password=liz&domain=
tractor&user=tractor> &domain=tractor&user=tractor
 
I get a time out when I try using SSLv2 that is the type of ssl we used
on our apache.
 
If I comment out the line curl_setopt($c,CURLOPT_SSLVERSION,2);
I get the following error:
 
SSL: error:140770FC:SSL routines:SSL23_GET_SERVER_HELLO:unknown protocol
 
When using _setopt($c,CURLOPT_SSLVERSION,3);
 
The error looks like
SSL: error:1408F10B:SSL routines:SSL3_GET_RECORD:wrong version number
 
I tried to execute curl from the shell using:
root_at_testserv01 [/home/www/HM]# curl -2
https://root:lizet34@XX.XXX.XXX.XXX/scripts/passwd?password=liz
<https://root:lizet34@xx.xxx.xxx.xxx/scripts/passwd?password=liz&domain=
tractor&user=tractor> &domain=tractor&user=tractor
and the reply is
[1] 28041
[2] 28042
root_at_testserv01 [/home/www/HM]#
[2]+ Done domain=tractor
 
 
with curl -3 I get the same SSL3_GET_ error
 
 
Why is it timing out? Should I set up the time out time?
 
 
Thanks in advance,
Lizet
 

_______________________________________________
http://cool.haxx.se/cgi-bin/mailman/listinfo/curl-and-php
Received on 2005-10-24