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

curl-and-php

Wrong return value

From: Stéphane Viaud-Murat <sviaud_at_madwaves.com>
Date: Tue, 13 Apr 2004 16:09:43 +0200

Hi there,

I have the following problem with this code:

$ch = curl_init();
             curl_setopt($ch, CURLOPT_URL, $url); //url varies
        curl_setopt($ch, CURLOPT_FOLLOWLOCATION,1);
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
        curl_setopt($ch, CURLOPT_FAILONERROR, 0);
        curl_setopt($ch, CURLOPT_COOKIEJAR, "cookies/$this->host.txt");

        curl_setopt($ch, CURLOPT_COOKIEFILE, "cookies/$this->host.txt");
        curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 3);
        curl_setopt($ch, CURLOPT_TIMEOUT, 10);
        curl_setopt ($ch, CURLOPT_SSL_VERIFYPEER, 0);
        curl_setopt($ch, CURLOPT_VERBOSE, 1);
        curl_setopt($ch, CURLOPT_HEADER, 0);

When I echo $html = curl_exec ($ch);
I sometimes get "1" as $html value, instead of the html page itself. The
script is time limited by PHP to 30 seconds, but this should not occur
since CONNECTTIMEOUT and TIMEOUT are set.
There are no curl_error returned.

I cannot reproduce the pb with curl command line since it happens at
random times. Usually cURL returns the html with no pb.

Does someone have any hints?

Thanks,
Stephane
Received on 2004-04-13