By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,847 Members | 1,375 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,847 IT Pros & Developers. It's quick & easy.

Autofilling a webform of other domain

P: 25
Hi all,

Is it possible to write a perl program that do autofilling of the login webform(username, password) of other domain (say hotmail.com). Assume domain name, username, password are passed as arguments to the perl program.

Thanks
DNK2007
Feb 18 '08 #1
Share this Question
Share on Google+
3 Replies


rajiv07
100+
P: 141
Try WWW::Mechanize module.You can search in CPAN

Hope it help

Regards
Rajiv
Feb 18 '08 #2

numberwhun
Expert Mod 2.5K+
P: 3,503
Try WWW::Mechanize module.You can search in CPAN

Hope it help

Regards
Rajiv
I agree with Rajiv. The Mechanize module is exactly what you want to use. In fact, on the Mechanize examples page, there is an example for using login/pwd.

Regards,

Jeff
Feb 18 '08 #3

P: 25
Hi all

I tried with a simple program and I stuck up with some error. The code goes like this
Expand|Select|Wrap|Line Numbers
  1.     #!/usr/bin/perl
  2.  
  3.     # turn on perl's safety features
  4.     use strict;
  5.     use warnings;
  6.  
  7.     # work out the name of the module we're looking for
  8.     my $module_name = $ARGV[0]
  9.       or die "Must specify module name on command line";
  10.  
  11.     # create a new browser
  12.     use WWW::Mechanize;
  13.     my $browser = WWW::Mechanize->new();
  14.  
  15.     # tell it to get the main page
  16.     $browser->get("http://search.cpan.org/");
  17.  
  18.     # okay, fill in the box with the name of the
  19.     # module we want to look up
  20.     $browser->submit_form(
  21.                            form_number => 1,
  22.                            fields      => { query => $module_name},
  23.                          );
  24.     $browser->click();
  25.  
  26.     # click on the link that matches the module name
  27.     $browser->follow_link( text_regex => qr{$module_name} );
  28.  
  29.     my $url = $browser->uri;
  30.  
  31.     # launch a browser...
  32.     system('Mac Safari', $url);
  33.  
  34.     exit(0);
  35.  
and the error is (program name is temp.pl)

There is no form numbered 1 at temp.pl line 20
Died at /Library/Perl/5.8.6/WWW/Mechanize.pm line 1724.

what might be the problem?


Thanks
DNK2007
Feb 19 '08 #4

Post your reply

Sign in to post your reply or Sign up for a free account.