in reply to LWP::UserAgent vs. NTLM Challenge/Response
use LWP::UserAgent; use HTTP::Request::Common; $url = 'http://foo.bar.com/some_path'; # Set up the ntlm client # and then the base64 encoded ntlm handshake message $ua = new LWP::UserAgent(keep_alive=>1); $netloc = 'foo.bar.com:80'; $domain_user_name = 'Domain\User'; $password = 'blahblah'; $ua->credentials($netloc, '', "$domain_user_name", "$password"); $request = GET $url; 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" } print $response->content;
|
|---|