Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

HELP!!! I am writing a perl program to get some data out of an Oracle web site. I could not seem to pass our IIS proxy server. I am using ActivePerl "v5.6.1 built for MSWin32-x86-multi-thread".

Here are the codes:

use LWP::UserAgent; my $ORASEARCH = 'http://updates.oracle.com/ARULink/PatchSearch/process_form?product_fa +mily=&product=&release=&platform=&language=0&patch_type =&file=&orderby=abr.last_updated_date&process=Submit&email=&userid=&bu +g=' ; my $ORAUID = 'userid' ; my $ORAPASSWD = 'password' ; my $LWPUA ; { $LWPUA = LWP::UserAgent->new; print &lookup_patch_desc(1324710) ; } sub lookup_patch_desc { my $BUGNO = $_[0] ; my $REQUEST = HTTP::Request->new(GET => $ORASEARCH . $BUGNO); $REQUEST->header('Accept' => 'text/html') ; $LWPUA->proxy(http => 'http://proxy.mycompany.com:80/') ; $REQUEST->proxy_authorization_basic("windowuserid","windowpassword +") ; $REQUEST->authorization_basic($ORAUID,$ORAPASSWD); return $LWPUA->request($REQUEST)->as_string; }

Here are the outputs:

HTTP/1.1 407 (Proxy Authentication Required) Proxy authentication requ +ired Proxy-Authenticate: NTLM Proxy-Authenticate: Basic realm="10.4.1.78" Content-Length: 503 Content-Type: text/html Content-Type: text/html; charset=iso-8859-1 Client-Date: Fri, 04 Oct 2002 17:26:03 GMT Client-Peer: 101.41.1.178:80 Client-Warning: Unsupported authentication scheme 'ntlm' Title: Error 407 X-Meta-Robots: noindex <html><head><title>Error 407</title> <meta name="robots" content="noindex"> <META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1 +"></head> <body> <h2>HTTP Error 407</h2> <p><strong>407 Proxy Authentication Required</strong></p> <p>You must authenticate with a proxy server before this request can b +e serviced . Please log on to your proxy server, and then try again.</p> <p>Please contact the Web server's administrator if this problem persi +sts.</p> </body></html>

All helps will be greatly appreciated!

Peter

Replies are listed 'Best First'.
Re: perl HTTP request through IIS proxy server
by meetraz (Hermit) on Oct 04, 2002 at 18:11 UTC
    If your proxy server will accept challenge-response NTLM authentication only, then I doubt you can use LWP::UserAgent, as you need a client which can authenticate using your NT security context. The only suggestion I have is to look into the Win32::Internet client module. Since this uses microsoft's own wininet.dll file, if anything can pass on the proper NTLM authentication, it should be this system. More info here
Re: perl HTTP request through IIS proxy server
by abell (Chaplain) on Oct 04, 2002 at 22:04 UTC

    At work I am using Linux and I had problems getting out of the LAN till I found an NTLM Authorization Proxy Server by this guy. No need to boot windows to read PM, now. Just point Mozilla's proxy settings to localhost:5865.

    The little beast is written in python and also works on Windows.

    The stupider the astronaut, the easier it is to win the trip to Vega - A. Tucket
Re: perl HTTP request through IIS proxy server
by ybiC (Prior) on Oct 04, 2002 at 17:58 UTC
    I don't know details of your Windows network environment, but have you tried passing the user id in the form of "ntdomain\username"?   That's worked for me when I've been behind a Microsoft proxy.   Very simple example at "(code) LWP with auth proxy".
        cheers,
        Don
        striving toward Perl Adept
        (it's pronounced "why-bick")

    Update: Ignore me and listen to brother meetraz.   8^p