download file from windows webserver box using LWP

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

I have a windows box and linux box. is a windows box with IIS the site is built using

Now i want to download a file from the windows box using HTTP(perl-LWP)
from the linux box, the site requires NTLM authentication. I have
written a code snippet(below)

#!/usr/bin/perl -w

use strict;
use warnings;
use LWP::UserAgent;
use LWP::Authen::Ntlm;
use HTTP::Request::Common;
use LWP::Debug qw(+);

$url = " "
$download = new LWP::UserAgent(keep_alive=>1);
$download->agent("Mozilla/3.0 (WinNT; I)");
$download->credentials(''," ","username" => 'password');

my $request = HTTP::Request->new(GET => $url);

$response = $download->request($request);

die "Error: ", $response->header('WWW-Authenticate') ||
    'Error accessing', #('WWW-Authenticate' is the realm-name)
    "\n",$response->status_line,"\n at $url\n Aborting" unless
The output is as follows:
LWP::UserAgent::new: ()
LWP::UserAgent::request: ()
LWP::UserAgent::send_request: GET
LWP::UserAgent::_need_proxy: Not proxied
LWP::Protocol::http::request: ()
LWP::Protocol::collect: read 811 bytes
LWP::Protocol::collect: read 424 bytes
LWP::Protocol::collect: read 1472 bytes
LWP::Protocol::collect: read 1724 bytes
LWP::UserAgent::request: Simple response: Unauthorized
LWP::Authen::Ntlm::authenticate: authenticate() has been called
Use of uninitialized value in exists at
/usr/lib/perl5/vendor_perl/5.8.5/LWP/ line 559.
LWP::Authen::Ntlm::authenticate: No username and password available
from get_basic_credentials().  Returning unmodified response object
Error: Negotiate, NTLM
401 Access Denied
 Aborting at ./ line 19.

Thanks in Advance

Site Timeline