- Original Message -
From: $Bill Luebkert [EMAIL PROTECTED]
To: mail admin [EMAIL PROTECTED]
Cc: WIN32-PERL [EMAIL PROTECTED]
Sent: Wednesday, October 08, 2003 9:03 AM
Subject: Re: WWW::Mechanize question
+
{$res = $ua-click(); # retrieve the content)
I found funny looking URL {$ur1) and repeated get;
this URL probably holds packed responses from 1-st form params
=
my $rr=$res-{_headers};
my %ha=%$rr;
$_=$ha{refresh};
my $ur1;
if (/(.)URL\=/){$ur1=$';};
$res = $ua-get($ur1);
after this $res contains needed page !
mail admin wrote:
In browser I see login form ;
after filling login passwd and clicking submit button I see html page.
here is the code snippet:
use WWW::Mechanize;
my $agen=WWW::Mechanize-new();
my $url=...
$agen-get($url);
die can't get start page: ,$agen-response-status_line unless
$agen-success;
my $uri=$agen-uri;
print uri=$uri\n;
my $fm1=$agen-current_form();
my $logi=...
my $pwd=...;
#$agen-set_fields('login'=$logi 'passwd'=$pwd);
$agen-set_fields('login'=$logi);
$agen-set_fields('passwd'=$pwd);
$agen-click();
$uri=$agen-uri;
print uri=$uri\n;
+
What is next step ?
how I am to access html form (which I see in browser after clicking
SUBMIT ?)
# get first page (I'm using a cookie jar to handle any cookies)
my $cookie_jar = HTTP::Cookies-new(File = $cookiefile, autosave = 1);
$ua = new WWW::Mechanize;
$ua-cookie_jar($cookie_jar);
$ua-agent('Mozilla/4.0');
$res = $ua-get($url);
if (not $res-is_success) {
die Error retrieving first page: $!;
}
# now fill in the third form on the page (change the 3 to the correct form
# on your page
$ua-form(3);
$ua-field('login', $login);
$ua-field('password', $password);
$res = $ua-click(); # retrieve the content
if ($res-is_success) {
my $content = $res-content(); # do something with content (parse it)
} else {
die Error retrieving form page: $!;
}
--
,-/- __ _ _ $Bill LuebkertMailto:[EMAIL PROTECTED]
(_/ / )// // DBE CollectiblesMailto:[EMAIL PROTECTED]
/ ) /-- o // // Castle of Medieval Myth Magic
http://www.todbe.com/
-/-' /___/__/_/_http://dbecoll.tripod.com/ (My Perl/Lakers stuff)
___
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
___
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs