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


RE: simple form filler problem

From: fbsd2 <>
Date: Sun, 12 Aug 2007 11:49:56 -0400

In most cases you have to get the login form before you can post it.
Try using iehttpheaders to create a log of the headers exchanged as you do
manual login from IE browser and then write your curl/php statements to
match what you see.

-----Original Message-----
[]On Behalf Of Dave Fobare
Sent: Sunday, August 12, 2007 10:51 AM
Subject: simple form filler problem

Under WAMP 1.7.2 on XP Pro, I'm trying to get the following simple form
filler to work:

$post = "UserID=myuserid&Password=mypassword";
$ch = curl_init("");

curl_setopt($ch, CURLOPT_POSTFIELDS, $post);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$out = curl_exec($ch);
echo $out;

All I'm getting out is the login page itself. I tried it another way:

    $curl = curl_init();
    curl_setopt($curl, CURLOPT_URL,"");
    curl_setopt($curl, CURLOPT_POST, 1);
    curl_setopt($curl, CURLOPT_POSTFIELDS,

    curl_exec ($curl);
    curl_close ($curl);

and I get the same result. cURL is working; I've enabled it properly in
the php.ini under Apache2, and php_curl does show up as enabled on the
WAMP control panel. And I can run other cURL snippets. Those examples
above are directly cribbed from public sources, but I still must be
doing something wrong. Help!


Dave Fobare


Received on 2007-08-12