rustycar has asked for the wisdom of the Perl Monks concerning the following question:
So, I run it, and I get this:use WWW::Mechanize; print "one\n"; my $mech = WWW::Mechanize->new( agent => 'Mozilla 5.0'); print "two\n" +; my $top = $mech -> get('http://10.0.0.200/'); print "three\n"; print $top->as_string; print "four\n"; print $mech->content; #$mech->set_fields( 'password' => 'secret' ); print "five\n"; #my $response = $mech->submit(); $response = $mech->submit_form( form_name => 'LoginForm', fields => { +password => "thepass" }, button => "Submit" ); print "six\n"; print $response->content;
The (mostly) full source of what should have been returned by the first get is here (I'd hoped that the 'readmore' tag would hide this, we'll see if it does or not):$ perl testit.pl one two three 500 Can't connect to 10.0.0.200:80 (connect: Operation now in progress +) Content-Type: text/plain Client-Date: Fri, 18 Jul 2008 01:44:21 GMT Client-Warning: Internal response 500 Can't connect to 10.0.0.200:80 (connect: Operation now in progress +) four 500 Can't connect to 10.0.0.200:80 (connect: Operation now in progress +) five There is no form named "LoginForm" at testit.pl line 26 Died at WWW/Mechanize.pm line 1727.
<html> <head> <link rel="shortcut icon" href="/resources/favicon.ico" type="image/x- +icon"> <META http-equiv ....bunch of these ....> <table height="100%" align="center"> <form name="LoginForm" method="post" action="Logon"> <tr> <td> <table class="tableBordered" width="55%" border="0" cellspacing="0" ce +llpadding="5" align="center"> <tr height="15"> <td colspan="5"></td> </tr> <tr height="26"> <td width="10"></td> <td colspan="4" align="left"> <table cellspacing="0" cellpadding="0" > <tr> <td><img src="logon_icon.gif" align="center" width="20" he +ight="20"></td> <td width="10"></td> <td><b>Logon</b></td> </tr> </table> </td> </tr> <tr height="50"> <td width="10"></td> <td nowrap> Password:</td> <td> <input type="password" cols="20" name="password" value="" max +length="15" size="15"></td> <td> <input class="inputButton" type="submit" name="Submit" value= +"OK"></td> <td width="10"></td> </tr> <tr height="20"> <td colspan="5" align="center"></td> </tr> </table> </td> </tr> </form> </table> </body> </html>
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: No response from a get or post????
by jethro (Monsignor) on Jul 18, 2008 at 02:45 UTC | |
|
Re: No response from a get or post????
by pc88mxer (Vicar) on Jul 18, 2008 at 03:12 UTC | |
|
Re: No response from a get or post????
by Gangabass (Vicar) on Jul 18, 2008 at 07:52 UTC |