Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

Re: Use LWP::UserAgent to go to a password protected ASP page

by shiza (Hermit)
on Aug 09, 2005 at 19:10 UTC ( #482378=note: print w/replies, xml ) Need Help??


in reply to Use LWP::UserAgent to go to a password protected ASP page

The code below was actually taken from a script I wrote that accessed an IIS server. It has been modified a bit, but should work:
#!/usr/bin/perl use strict; use LWP; use LWP::UserAgent; my $URI = 'https://www.domain.com/protected_realm'; my $user = 'foo'; my $pass = 'bar'; # define user agent my $ua = LWP::UserAgent->new(); $ua->agent("USER/AGENT/IDENTIFICATION"); # make request my $request = HTTP::Request->new(GET => $URI); # authenticate $request->authorization_basic($user, $pass); # except response my $response = $ua->request($request); # get content of response my $content = $response->content(); # do whatever you need to do with the content here print $content; exit;

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://482378]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (4)
As of 2020-05-31 08:02 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    If programming languages were movie genres, Perl would be:















    Results (173 votes). Check out past polls.

    Notices?