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

curl-and-php

Curl script giving "Page Not Found" about 50% of the time...

From: Zachary Smith <zachary.smith_at_delphianweb.com>
Date: Sun, 23 Feb 2003 17:28:49 -0500

Hi,

I have written a set of scripts that utilize cURL within PHP to post forms
and get responses from a billing system API. I am running these on a
Linux/Apache box with libcurl 7.9.3 and the billing system is running on the
same network on a different server, right next to it. I have tested the
network (ping 1000) and have 0 dropped packets.

So, what is happening is that 50% (seemingly randomly, doing the exact same
action) the script will fail and instantly return a "Page not Found" error
in the browser. I have set the timeout in PHP to be 30 seconds, but it will
fail almost right away, so that can't be the problem.

Here is part of the function I am using to call the API:
//------------Code starts here------------//
$ch = curl_init();
curl_setopt ($ch, CURLOPT_URL, $url);
curl_setopt ($ch, CURLOPT_HEADER, 0);
if(!empty($values['proxy']))
{
curl_setopt ($ch, CURLOPT_PROXY, $values['proxy']);
}
curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt ($ch, CURLOPT_POST, 1);
curl_setopt ($ch, CURLOPT_POSTFIELDS, $q);
$result = curl_exec ($ch);
curl_close ($ch);
return $result;
//------------Code ends here------------//

What is the best way to go about finding the problem here? I couldn't find
any details on logging with libcurl...

Also, after getting the result from this page, we use a header location to
forward to the new page. Is this better done with curl using the
CURLOPT_FOLLOWLOCATION (I can't seem to find much documentation on this
one).

Thanks in advance for any help,
Best,
Zachary Smith

-------------------------------------------------------
This SF.net email is sponsored by: SlickEdit Inc. Develop an edge.
The most comprehensive and flexible code editor you can use.
Code faster. C/C++, C#, Java, HTML, XML, many more. FREE 30-Day Trial.
www.slickedit.com/sourceforge
Received on 2003-02-24