in reply to Lwp and NTLM authentication

The following code works well for me behind a proxy with NTLM authentication.
my $ua = LWP::UserAgent->new; $ua->env_proxy; my $response = $ua->get($URL); if ($response->is_success) { print $response->decoded_content; }

Replies are listed 'Best First'.
Re^2: Lwp and NTLM authentication
by bcarroll (Pilgrim) on Feb 10, 2012 at 15:07 UTC

    If $ua->env_proxy; doesn't work, here is another example I have used in the past.

    sub GetURL { ########## # # GetURL is a generic LWP sub used to GET a URL using the provided # proxy settings, upon success it returns the page content +s or UNDEF # ########## my $url = shift; my $userAgent = new LWP::UserAgent; $userAgent->timeout( 3 ); # 3 sec timeout $userAgent->proxy( 'http' , $PROXY ) if $PROXY; my $request = HTTP::Request->new( GET => "$url" ); $request->proxy_authorization_basic( $USERNAME , $PASSWORD ) if $P +ASSWORD; my $result = $userAgent->request( $request) ; if ( $result->is_success ) { return $result->content; } return undef; }
      Is there really no need to use of Authen::NTLM / LWP::Authen::Ntlm?
      Is it really going to set NTLM authentication whereas proxy_authorization_basic suggests that HTTP Basic authentication is used??

      print+qq(\L@{[ref\&@]}@{['@'x7^'!#2/"!4']});
Re^2: Lwp and NTLM authentication
by codeacrobat (Chaplain) on Feb 10, 2012 at 15:38 UTC
    In which environment variables do you have to set the user/password. How do you specify NTLM instead of BasicAuth?

    print+qq(\L@{[ref\&@]}@{['@'x7^'!#2/"!4']});

      This is what I have...

      set http_proxy=http://DOMAIN\USERNAME:PASSWORD@myproxy.mydomain.com:8080

      I guess I am using BasicAuth instead of NTLM...sorry