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

curl-and-php

problem with curl and php5 but not php4

From: Brocha Strous <Brocha.Strous_at_kayote.com>
Date: Mon, 15 May 2006 12:42:59 +0300

I have a simple curl call to a customer website. When the customer was
running php4 everything worked fine. When the customer switched to php5
I began to receive "Got Nothing" error (#52) about 15% of the time.

libcurl/7.10.6 OpenSSL/0.9.7a ipv6 zlib/1.1.4
Customer's PHP versions: PHP 5.0.5, PHP 4.3.2

My curl code:

<?php

        $fields = "Mode=query&data=12345";

        // URL of API on remote server
        $host = "http://myclientswebsite/api.php";

        // Initialize curl
        $ch = curl_init();

        // Curl Options
        // set curl options
        curl_setopt($ch, CURLOPT_URL, $host);
        curl_setopt($ch, CURLOPT_POST, 1);
        curl_setopt($ch, CURLOPT_POSTFIELDS, $fields);
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
        curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 20);
        curl_setopt($ch, CURLOPT_TIMEOUT, 30);
        // Dont check the SSL certificate is from trusted source
        curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);

        // Execute and get response
        $result = curl_exec($ch);

        // Should look at $result and check that it makes sense
        $curl_err = curl_errno($ch);

        // Close the curl
        curl_close($ch);
        
        // Return the error if curl has an error, else return result
              if ( $curl_err != 0 )
        {
                echo $curl_err;
        }
        else
        {
                echo $result;
        }
}
?>

The customers page:

<?php

// Do some processing

echo "True, some data string\r";
exit;
?>

Thanks,
Brocha

_______________________________________________
http://cool.haxx.se/cgi-bin/mailman/listinfo/curl-and-php
Received on 2006-05-15