[ale] Opening a webpage with a password?
Fletch
fletch at phydeaux.org
Fri Jun 10 08:38:47 EDT 2005
>>>>> "Christopher" == Christopher Bergeron <christopher at bergeron.com> writes:
\
Christopher> Rob - it depends on the type of authentication used
Christopher> on the site. Older sites (aka one's that displayed
Christopher> the browsers' native authentication popup), could be
Christopher> accessed using the uid at pw URL combo that you
Christopher> described. Newer sites, however, use different
Christopher> authentication methods - so your code won't work.
I wouldn't necessarily categorize either as "newer" or "older". The
type that works using the browser popup is using authentication at the
HTTP layer; the other scheme is to handle it in the application layer
using cookies or some other form session id (e.g. something embedded
in the URL). Both have been around for ages; however handling it in
the application has advantages (for instance being able to offer a way
for the user to logout, since pretty much Opera's the only browser
that offers a way to discard HTTP auth credentials short of quitting
the browser) and is the way most people tend do things nowdays.
As for automating it, you basically will have to submit (POST) the
filled in login page form to the browser and accept any cookies that
sends back and then send those same cookies along when you try to
access a protected page. Perl (of course :) has the WWW::Mechanize
module which sits on top of LWP and provides support for this type of
thing. If you're doing any heavy spidering Mechanize already knows
how to do a bunch of the gruntwork you'd have to reimplement
yourself.
http://search.cpan.org/~petdance/WWW-Mechanize-1.12/lib/WWW/Mechanize.pm
--
Fletch | "If you find my answers frightening, __`'/|
fletch at phydeaux.org| Vincent, you should cease askin' \ o.O'
| scary questions." -- Jules =(___)=
| U
More information about the Ale
mailing list