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
In reply to Getting result page using WWW::Mechanize by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |