automate web login
From: David Byrne (dbyrne_commerce_at_yahoo.com)
Date: 11/24/03
- Next message: Wiggins D Anconia: "Re: automate web login"
- Previous message: Mark Lobue: "Re: Strange characters"
- Next in thread: Wiggins D Anconia: "Re: automate web login"
- Maybe reply: Wiggins D Anconia: "Re: automate web login"
- Maybe reply: Wiggins D'Anconia: "Re: automate web login"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Mon, 24 Nov 2003 12:41:31 -0800 (PST) To: beginners@perl.org
Greetings,
I used CPAN (libwww-perl) docs as my main reference
and generated the following script (trying 'content'
as well as 'authorization_basic' for user id & pw),
but keep getting "405 Method Not Allowed".
I would very much appreciate any suggestions.
Cheers,
David
#!perl -w
use LWP::UserAgent;
use HTTP::Cookies;
$ua = LWP::UserAgent->new;
$ua->cookie_jar(HTTP::Cookies->new(file =>
"lwpcookies.txt", autosave => 1));
# Create a request
my $req = HTTP::Request->new(POST =>
'http://www.gene-regulation.com/');
$req->content_type('application/x-www-form-urlencoded');
# Login
# $req->content('user=gratner&password=motley');
$req->authorization_basic('gratner', 'motley');
# Pass request to the user agent and get a response
back
my $res = $ua->request($req);
# Check the outcome of the response
if ($res->is_success) {
open (OUT, ">out.html");
print OUT $res->content;
}
else {
print $res->status_line, "\n";
}
__________________________________
Do you Yahoo!?
Free Pop-Up Blocker - Get it now
http://companion.yahoo.com/
- Next message: Wiggins D Anconia: "Re: automate web login"
- Previous message: Mark Lobue: "Re: Strange characters"
- Next in thread: Wiggins D Anconia: "Re: automate web login"
- Maybe reply: Wiggins D Anconia: "Re: automate web login"
- Maybe reply: Wiggins D'Anconia: "Re: automate web login"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|