Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Downloading a file that requires username and password?

Status
Not open for further replies.

jonx

Programmer
Sep 2, 2003
34
0
0
US
Code:

open ( CWFILE,">file.xls");

$URL = get("
print CWFILE "$URL\n\n";
close CWFILE;

When I do this though, the file is empty... So I went to my browser to check if the file exists, and it does... so thats good. I realized though that when I download the file in my browser, it is asking me for a username and password. Its easy to insert a username and password in my browser to download the file, but how do I do it using perl?

I tried adding the username and password to the query string, but that didn't work. There has to be a way to do it... Help!! =)

Thanks

-Jon
 
Take a peek at this thread:


You might want to look into the modules LWP::Simple and lwpcook.

LWP::Simple allows you to embed a username password into your url just as if you are typing it in the browser, but it only works for basic authentication via .htaccess.

Never used it, but it is a place to start looking.
 
that does work for me =( is there another way to do it? There has to be a way to send a request using LWP::useragent right?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top