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

curl-and-php

Re: cURL HTTP POST problem

From: Dave Withnall <withnall_at_connexus.net.au>
Date: Mon, 05 May 2003 14:28:37 +1000

The reason it failed to do anything was because of the timeout setting you
had. Turn it off completely.
Theres a large quantity of data being downloaded and your timeout is too
low for the transfer to finish before the limit is hit.

Try using
CURLOPT_VERBOSE, 1
and
CURLOPT_HEADER, 1

for trouble shooting.
you might also want to set CURLOPT_FAILONERROR to zero before assuming your
code works perfectly as well. disabling error reporting isn't the best idea
when starting things :)

Cheers
D.

At 08:35 PM 4/05/2003 -0700, Philip Wasson wrote:
>I am a CURL newbe and I am frustrated because I can't get HTTP POST to
>work using cURL. I used an HTTP monitor (NAVISCOPE) to watch the manual
>POST transaction using Internet Explorer to see exactly what was
>POSTed. The form is at:
>
>http://lapublichealth.org/rating/
>
>Here are the results:
>
>POST http://lapublichealth.org/rating/ratesearchaction.cfm HTTP/1.0
>Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg,
>application/vnd.ms-powerpoint, application/x-shockwave-flash,
>application/pdf, application/msword, application/vnd.ms-excel, */*
>Referer: http://lapublichealth.org/rating/
>Accept-Language: en-us
>Content-Type: application/x-www-form-urlencoded
>Proxy-Connection: Keep-Alive
>User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; Q312461;
>.NET CLR 1.0.3705; .NET CLR 1.1.4322)
>Host: lapublichealth.org
>Content-Length: 57
>Pragma: no-cache
>
>dba=&address=&city=&zipcode=&score=100&sort=dba&B1=Submit
>
>The last line is the actual post field. I actually cut and pasted that
>line (to avoid typing mistakes) into CURLOPT_POSTFIELDS as follows:
>
>curl_init();
>
>curl_setopt($ch,
>CURLOPT_URL,"http://lapublichealth.org/rating/ratesearchaction.cfm");
>curl_setopt($ch, CURLOPT_FAILONERROR, 1);
>curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
>curl_setopt($ch, CURLOPT_TIMEOUT, 3); //times out after 4s
>curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
>curl_setopt($ch, CURLOPT_POST, 1);
>curl_setopt($ch, CURLOPT_POSTFIELDS,
>"dba=&address=&city=&zipcode=&score=100&sort=dba&B1=Submit");
>
>$result=curl_exec ($ch);
>curl_close ($ch);
>
>echo "result=".$result;
>?>
>
>This code produces no result:
>
>result=''
>
>I would appreciate any ideas you might have!
>Phil
>
>
>
>
>-------------------------------------------------------
>This sf.net email is sponsored by:ThinkGeek
>Welcome to geek heaven.
>http://thinkgeek.com/sf
>

-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
Received on 2003-05-05