download with HTML::FORM login and password on page
- From: Winston75 <baptiste.fevre@xxxxxxxxx>
- Date: Mon, 28 Apr 2008 04:38:13 -0700 (PDT)
hi,
i don't understand my code is corrupted at form "value" instance??
error prompt : Can't call method "value" on an undefined value at
ligne 27 (here : $form->find_input('txtusername')-
value($user);) ??
any ideas, thanks
#!/usr/bin/perl -w
use strict;
use warnings;
use LWP::UserAgent;
use HTML::Form;
my ($user,$pass ) = qw(username password);
my $base = 'http://www.mysite/login.asp/';
my $ua = LWP::UserAgent->new(agent => 'Microsoft Internet Explorer
6.0' );
my $req = HTTP::Request->new( GET => "${base}" );
my $res = $ua->request($req);
die $res->status_line if not $res->is_success;
my $form = (HTML::Form->parse($res->content, $base))[1];
$form->find_input('txtusername')->value($user);
$form->find_input('txtpassword')->value($pass);
$ua->request($form->click );
.
- Follow-Ups:
- Re: download with HTML::FORM login and password on page
- From: Peter Makholm
- Re: download with HTML::FORM login and password on page
- Prev by Date: Re: WWW::Mechanize doesn't always follow_link(text
- Next by Date: Re: use perl to draw Venn Diagram
- Previous by thread: FAQ 3.14 How can I write a GUI (X, Tk, Gtk, etc.) in Perl?
- Next by thread: Re: download with HTML::FORM login and password on page
- Index(es):