Hello
 
I would like to be able to login automatically into site 123.45.67.89 by
providing a user name and a password and print the first page after the
login screen.
I am using the script below which always prints the login.asp screen
instead of the firstpage.asp screen.
 
I am running perl 5.8.7 on a windows 2000 system
 
Any ideas how to solve the issue will be greatly appreciated.
 
Thanks
Erich
 
#!/usr/bin/perl
use WWW::Mechanize;
use HTTP::Cookies;
 
# What site am I connecting to?
my $url = <http://1> <http://123.45.67.89> http://
<http://123.45.67.89/login.asp> 123.45.67.89/login.asp;
 
# Username
my $username = "my_name";
 
# Password
my $password = "my_password";
 
# Create a new instance of WWW::Mechanize
my $mechanize = WWW::Mechanize->new(autocheck => 1);
 
# Supply the necessary credentials
$mechanize->credentials($url, $username, $password);
 
# Manage cookies
$mechanize->cookie_jar(HTTP::Cookies->new);
 
# Retrieve the desired page
$mechanize->get("http://123.45.67.89/firstpage.asp
<http://123.45.67.89/firstpage.asp> ");
 
# Assign the page content to $page
my $page = $mechanize->content;
 
# Output the page
print $page;

_______________________________________________
ActivePerl mailing list
[email protected]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
  • Mechanize Singer, Erich
    • Mechanize Singer, Erich

Reply via email to