curl-and-php
RE: simple form filler problem
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.
http://www.blunck.se/iehttpheaders/iehttpheaders.html
-----Original Message-----
From: curl-and-php-bounces_at_cool.haxx.se
[mailto:curl-and-php-bounces_at_cool.haxx.se]On Behalf Of Dave Fobare
Sent: Sunday, August 12, 2007 10:51 AM
To: curl-and-php_at_cool.haxx.se
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("http://www.mysite.com/privatelogin");
curl_setopt($ch, CURLOPT_POSTFIELDS, $post);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$out = curl_exec($ch);
curl_close($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,"http://www.mysite.com/privatelogin");
curl_setopt($curl, CURLOPT_POST, 1);
curl_setopt($curl, CURLOPT_POSTFIELDS,
"UserID=myuserid&Password=mypassword");
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!
Thanks,
Dave Fobare
_______________________________________________
http://cool.haxx.se/cgi-bin/mailman/listinfo/curl-and-php
_______________________________________________
http://cool.haxx.se/cgi-bin/mailman/listinfo/curl-and-php
Received on 2007-08-12