use LWP::UserAgent; use HTTP::Request::Common; use HTTP::Headers; use LWP::Debug qw(+); my $url = 'http://site.domine.com'; my $ua = new LWP::UserAgent(keep_alive=>1); $ua->credentials('site.domine.com:80', '', 'domine\\username', 'password'); $request = HTTP::Request->new( GET => $url, HTTP::Headers->new(user_agent => 'Internet Explorer/6.0', www_authenticate => 'NTLM') ); print "--Performing request now...-----------\n"; $response = $ua->request($request); print "--Done with request-------------------\n"; if ($response->is_success) {print "It worked!->" . $response->code . "\n"} else {print "It didn't work!->" . $response->code . "\n"} #### LWP::UserAgent::new: () LWP::UserAgent::request: () LWP::UserAgent::send_request: GET http://site.domine.com LWP::UserAgent::_need_proxy: Not proxied LWP::Protocol::http::request: () LWP::Protocol::collect: read 690 bytes LWP::Protocol::collect: read 966 bytes LWP::Protocol::http::request: Keep the http connection to site.domine.com:80 LWP::UserAgent::request: Simple response: Unauthorized LWP::Authen::Ntlm::authenticate: authenticate() has been called LWP::Authen::Ntlm::authenticate: In first phase of NTLM authentication LWP::Authen::Ntlm::authenticate: Returning response object with auth header: Authorization NTLM TlRMTVNTUAABAAAAB7IAAAgACAAgAAAA LWP::UserAgent::request: () LWP::UserAgent::send_request: GET http://site.domine.com LWP::UserAgent::_need_proxy: Not proxied LWP::Protocol::http::request: () LWP::Protocol::collect: read 369 bytes LWP::Protocol::collect: read 1170 bytes LWP::Protocol::http::request: Keep the http connection to site.domine.com:80 LWP::UserAgent::request: Simple response: Unauthorized LWP::Authen::Ntlm::authenticate: authenticate() has been called LWP::Authen::Ntlm::authenticate: In second phase of NTLM authentication LWP::Authen::Ntlm::authenticate: Returning response object with auth header: Authorization NTLM TlRMTVNTUAADAAAAGAAYAEAAA LWP::UserAgent::request: () LWP::UserAgent::send_request: GET http://site.domine.com LWP::UserAgent::_need_proxy: Not proxied LWP::Protocol::http::request: () LWP::Protocol::collect: read 690 bytes LWP::Protocol::collect: read 849 bytes LWP::Protocol::http::request: Keep the http connection to site.domine.com:80 LWP::UserAgent::request: Simple response: Unauthorized LWP::Authen::Ntlm::authenticate: authenticate() has been called LWP::Authen::Ntlm::authenticate: In first phase of NTLM authentication