RE: :Mechanize question
"Duzenbury, Rich" <[email protected]>
| Newsgroups | gmane.comp.lang.perl.modules.lwp |
|---|---|
| Message-ID | <[email protected]> |
Hello,
Hmm, not sure, but I recently did a post, and I made sure to explicitly
set the form number, and explicity click the correct submit button:
print "Accessing the login page\n";
$mech->get($loginurl);
die "Could not access login page: ", $mech->response->status_line unless
$mech->success;
# Now, fill in the form and submit it.
print "Logging in\n";
$mech->form_number(1);
$mech->field( 'txtActNumber', $login );
$mech->field( 'txtActPass' , $password);
$mech->field( 'radlLogin', "Download");
$mech->click_button('name' => 'btnLogin');
die "Could not submit login form: ", $mech->response->status_line unless
$mech->success;
Regards,
Rich Duzenbury
IT Department
Brokers International, Ltd.
1200 E. Main
Panora, IA 50216
(800) 362-1097 ext 1401
> -----Original Message-----
> From: M. Lewis [mailto:[email protected]]
> Sent: Wednesday, December 13, 2006 10:58 PM
> To: [email protected]
> Subject: WWW::Mechanize question
>
>
> I've used WWW::Mechanize before, but not for posting to a
> form on the web. I'm trying to automate some very boring
> postings of spammers to the rfci website. I'm not having much
> luck with it.
>
> mech-dump tells me:
>
> [cajun@moe new-1206]$ mech-dump
> http://www.rfc-ignorant.org/tools/submit_form.php?table=whois
> GET http://www.rfc-ignorant.org/tools/lookup.php
> domain= (text)
>
> POST http://www.rfc-ignorant.org/tools/submit.php
> table=whois (hidden readonly)
> domain= (text)
> evidence= (textarea)
> submit=List me! (submit)
>
>
> NOTE: There are two fields named 'domain'. This is part of my
> problem I think.
>
> Also, If I try to explicitly put something in the 'evidence'
> field, it's telling me there is no such field.
>
> Here's a snippet of the applicable code:
>
> my $browser = WWW::Mechanize->new();
> # tell it to get the main page
> $browser->get("http://rfc-ignorant.org/tools/submit_form.php?t
> able=whois");
> $browser->field("domain", $_); # there are two fields named
> domain $browser->field("evidence", @body); #
> $browser->set_visible( $_, @body ); $browser->click();
>
> Thanks for any pointers where I'm going wrong.
>
> Mike
>
> --
>
> The programmer's national anthem is 'AAAAAAAAHHHHHHHH'.
> -Weinberg, p.152
> 23:50:01 up 14 days, 13:16, 0 users, load average: 0.07,
> 0.29, 0.33
>
> Linux Registered User #241685 http://counter.li.org
>