in reply to Re: LWP::UserAgent Authentication
in thread LWP::UserAgent Authentication

Tried that. That one's right out of the LWP::Authen::NTLM module write-up. Didn't work.

Replies are listed 'Best First'.
Re^3: LWP::UserAgent Authentication
by varian (Chaplain) on Mar 20, 2007 at 17:46 UTC
    Alternatively try to access the page with a regular browser. If it pops up with a 'standard' username/password box then make a note of the realm and insert that into your credentials method as the second argument. You may be dealing with a server that requires regular digest authentication.
    Popup will have something like this:
    Enter username and password for "realmname_here" at http://...
    Update: btw make sure to append the portnumber (:80) to your fully qualified hostname in argument one, otherwise authentication can fail even with correct credentials.
      I tried all different strings for the realm. None of them worked. It doesn't specify the realm when it asks for the password. The word 'realm' doesn't even appear in a Sniffer trace. That's why I expected my sample code to work - it by-passes the credentials/realm problem and returns with the correct username/password. I also made sure I included the port number - 80. That was spelled out on one of the web sites: www.tutorials-blog.com/perl/LWPUserAgent-credentials/.
        The response headers will give away more clues about required authentication, try to insert this into your code:
        $response = $ua->request( <-- your details go here my @headers = $response->header_field_names(); foreach my $h (@headers) { print "$h = ",$response->header($h),"\n"; }
        In particular investigate the output for the WWW-Authenticate header.
        A reply falls below the community's threshold of quality. You may see it by logging in.

        It would be much easier to help you if you would edit your original post and put <code></code> tags around your code.


        ___________
        Eric Hodges