Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
I had made an attempt to use WWW::Mechanize module using the following code.
In the below code, yes.html contains two field say UserId and Passwd and action for the form is login.cgi. If i use the following code , getting result a "blank" page. While looking into the error_log file, shows the error asThere is no form numbered 1 at /usr/pweb/phonekerala/cgi-bin/thisis.pl + line 26 Can't call method "value" on an undefined value at /usr/lib/perl5/site +_perl/5.6.0/WWW/Mechanize.pm line 409.
How can i get the display page using these parameters?
After running the program i should modify the code to integrate click function etc. So please help me to provide a solution to my above said problem.
Thanks
Code ..... Getting result page as blank.........#!/usr/bin/perl print "Content-type: text/html\n\n"; use warnings; use strict; use WWW::Mechanize; use CGI; my $cgi = CGI->new(); my $form = $cgi->Vars; my $agent = WWW::Mechanize->new(); $agent->get('http:/mydomain.com/html/yes.html'); $agent->form_number('1'); $form->{UserId}='test01'; $form->{Passwd} = 's'; $agent->field('UserId',$form->{UserId}); $agent->field('Passwd',$form->{Passwd}); $agent->submit(); $agent->get('http://mydomain.com/cg-bin/login.cgi?UserId='.$form-> +{UserId}.'&Passwd='.$form->{Passwd}); print $agent->content();
20030704 Edit by Corion: Added formatting
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Getting result page using WWW::Mechanize
by Corion (Patriarch) on Jul 04, 2003 at 09:28 UTC | |
by Anonymous Monk on Jul 04, 2003 at 10:10 UTC | |
by Corion (Patriarch) on Jul 04, 2003 at 10:31 UTC | |
by Anonymous Monk on Jul 04, 2003 at 11:03 UTC | |
by Corion (Patriarch) on Jul 04, 2003 at 11:11 UTC | |
|