----------------------------------------------------------POST /index.php HTTP/1.1<br> Host: www.hellboundhackers.org<br> User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8.1.13) Gecko +/20080208 Mandriva/2.0.0.13-1.1mdv2008.0 (2008.0) Firefox/2.0.0.13<br +> Accept: text/xml,application/xml,application/xhtml+xml,text/html;q=0.9 +,text/plain;q=0.8,image/png,*/*;q=0.5 <br> Accept-Language: en-us,en;q=0.5<br> Accept-Encoding: gzip,deflate<br> Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7 <br> Keep-Alive: 300<br> Connection: keep-alive<br> Referer: http://www.hellboundhackers.org/index.php<br> Cookie: __utma=240219034.940153525.1209163011.1213625020.1213626434.79 +;<br> __utmb=240219034; fusion_visited=TRUE;<br> __utmz=240219034.120 +9310076.15.2.utmccn=(organic)|utmcsr=google|utmctr=site%3Awww.hellbou +ndhackers.org+ezekiel|utmcmd=organic;<br> PHPSESSID=rl6oeo664r7g9lnd7gin5ilvn3; __utmc=240219034<br> Content-Type: application/x-www-form-urlencoded<br> Content-Length: 47<br> user_name=***&user_pass=***&login=Login<br> <br> Respond<br> <br> HTTP/1.x 302 Found <br> Date: Mon, 16 Jun 2008 13:48:06 GMT<br> Server: Apache<br> X-Powered-By: PHP/5.0.4<br> Set-Cookie: PHPSESSID=rl6oeo664r7g9lnd7gin5ilvn3; path=/<br> Set-Cookie: fusion_user=24236.f31e0a8a2cefed417ec46c7675e4142d;<br> expires=Mon, 16 Jun 2008 16:48:06 GMT; path=/<br> Expires: Thu, 19 Nov 1981 08:52:00 GMT<br> Cache-Control: no-store, no-cache, must-revalidate,<br> post-check=0, +pre-check=0<br> Pragma: no-cache<br> Location: index.php<br> Content-Length: 0<br> Connection: close<br> Content-Type: text/html<br>
But then the GET request returns page, where I'm not logged in... I got the respond header printed out, and it seems correct, so I've got no idea what's wrong. However strange is that normally this code returns also the source of the page ( withouth the second GET request ), but it only returns the header.use LWP::UserAgent; use HTTP::Cookies; $agent = LWP::UserAgent->new; $agent->agent('Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8.1.13) Ge +cko/0000000000 Mandriva/2.0.0.13-1.1mdv2008.0 (2008.0) Firefox/2.0.0. +13'); $url = 'http://www.hellboundhackers.org/index.php'; my $request = HTTP::Request->new(POST => $url); $request->content_type("application/x-www-form-urlencoded"); $request->content('user_name=***&user_pass=***&login=Login'); $request->content_length(47); $request->referer('http://www.hellboundhackers.org/index.php'); $respond = $agent->request($request); print "this is request ".$request->as_string()."\n"; print "this is respond".$respond->as_string()."\n"; my $request = HTTP::Request->new(GET=>$url); $response = $agent->request($request); if ( $response->is_success) { print $request->as_string(); print $response->content; die; }
use WWW::Mechanize; use HTML::Form; use LWP::UserAgent; my $agent = LWP::UserAgent->new; my $url = 'http://www.hellboundhackers.org/index.php'; my $response = $agent->get($url); my $mech = WWW::Mechanize->new ; my @forms = HTML::Form->parse($response); my $username = $forms[1]->find_input("user_name","text"); my $password = $forms[1]->find_input("user_pass","password"); $username->value("***"); $password->value("***"); my $filled_out_request = $forms[1]->click; $response = $agent->request($filled_out_request); print $response->content;
Sorry for the lenght of this post, I just wanted to make sure, everything is included...<form id='loginform' method='post' action='index.php'> <div style="text-align: center;"> <input type='text' name='user_name' class='textbox' style='width:100px +' /><br /> <input type='password' name='user_pass' class='textbox' style='width:1 +00px' /><br /> <input type='checkbox' name='remember_me' value='y' />Remember Me<br / +><br /> <input type='submit' name='login' value='Login' class='button' /><br / +> </div> </form><br >
In reply to POSTing information on a web page by clone4
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |