#!/usr/bin/perl use LWP::UserAgent; my $url = 'http://sample.com/sites/projcentral/test.xls'; my $ua = new LWP::UserAgent(keep_alive=>1); $ua->no_proxy; #$ua->agent('MSIE/6.0'); $ua->credentials('sample.com','/sites/projcentral/','mohan' => 'mohan123'); $ua->timeout(15); my $request = HTTP::Request->new('GET'); $request->url($url); my $response = $ua->request($request); my $code = $response->code; print "Return Code ====>\n $code\n"; my $headers = $response->headers_as_string; #If the Error is 401.2 then, #The authentication methods that were tried are either disabled, or you are attempting to use NTLM through a proxy server. print "Headers ======>\n $headers\n"; # HTML body: my $body = $response->content; print "================\n$body====================\n";