#!/usr/bin/perl
use strict;
use WWW::Mechanize;
use HTTP::Cookies;
use LWP::Debug qw(+);
my $outfile = "out.htm";
my $url = "https://yahoomail.com/";
my $username = "abcdef";
my $password = "xxxx";
my $mech = WWW::Mechanize->new();
$mech->cookie_jar(HTTP::Cookies->new());
$mech->get($url);
$mech->form_name('login');
$mech->field(login => $username);
$mech->field(passwd => $password);
$mech->click();
$mech->follow_link(text => "click here", n => 1);
my $output_page = $mech->content();
open(OUTFILE, ">$outfile");
print OUTFILE "$output_page";
close(OUTFILE);
.
LWP::UserAgent::new: () LWP::UserAgent::request: () HTTP::Cookies::add_cookie_header: Checking yahoomail.com for cookies HTTP::Cookies::add_cookie_header: Checking .com for cookies LWP::UserAgent::send_request: GET https://yahoomail.com/ LWP::UserAgent::_need_proxy: Not proxied LWP::UserAgent::request: Simple response: Not Implemented There is no form named "login" at weblogin.pl line 13 Can't call method "value" on an undefined value at C:/Perl/site/lib/WWW/Mechaniz e.pm line 538..
Edited by [planetscape] - added [id://17558|code] tags
2006-08-06 [id://340870|Retitled] by [planetscape], as per Monastery [id://341118|guidelines]
Original title: 'Error to acees the website'
Personally, I can't load the URL at all.
perlmonks.org content © perlmonks.org and Anonymous Monk, jhourcle
prlmnks.org © 2006 edmund von der burg (eccles & toad)
v 0.03