Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Trying to use WWW:Mech to login into a webpage

Status
Not open for further replies.

skits2

Technical User
Sep 30, 2006
5
0
0
US
I have been trying to use to log into the webpage
but have not had much luck. All that happens when I print out the urls I am at is it prints the initial login page. This is the code i'm using. Can anyone spot a bug or help me out? I tried it using credentials and submit.


#!c:\perl\bin\perl
use Net::FTP;
use File::Copy;
use CWD;
use File::stat;
use Time::localtime;
use LWP::Simple;
use HTML::LinkExtor;
use Data::Dumper;
use use File::Basename;



$count=1;

my $mech = $mech->credentials( '****' => '*****' );
$mech->get("link2me.com/index.cgimenu=loginrefresh");

print $mech->uri,"\n";
my $url = $mech->uri;
$content = get($url) || die "get: $!";

open (OVERWRITE, ">link_2_me_$count.htm") or die "$! error trying to overwrite";
print OVERWRITE $content;

$password="****";
$usrname="****"

$mech->set_visible( $usrname, $password ) ;
$mech->submit();

print $mech->uri;

my $url = $mech->uri;
$content = get($url) || die "get: $!";

$count++;

open (OVERWRITE, ">link_2_me_$count.htm") or die "$! error trying to overwrite";
print OVERWRITE $content;

Thanks
Scott
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top