Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

Answer: How do I retrieve .htpasswd protected html documents?

( #36438=categorized answer: print w/ replies, xml ) Need Help??

Q&A > HTTP and FTP clients > How do I retrieve .htpasswd protected html documents? contributed by KM

Yes, you sure can. Use LWP::UserAgent:

use LWP::UserAgent; my $ua = new LWP::UserAgent; my $req = new HTTP::Request 'GET', 'http://www.you.com/dir'; $req->authorization_basic('userid', 'password'); my $result = $ua->request($req)->as_string;

Read the POD for the module, as well as lwp-cook for other options/uses.

Cheers,
KM

Comment on Answer: How do I retrieve .htpasswd protected html documents?
Download Code
Log In?
Username:
Password:

What's my password?
Create A New User
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others browsing the Monastery: (15)
As of 2014-11-21 20:44 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My preferred Perl binaries come from:














    Results (117 votes), past polls