Perl LWP content request behind firewall and proxy server

From: demonhunter (demonicdruid_at_hotmail.com)
Date: 08/15/04

  • Next message: Gunnar Hjalmarsson: "Re: Perl LWP content request behind firewall and proxy server"
    Date: 15 Aug 2004 07:53:06 -0700
    
    

    Hi,
    I am trying to fetch a web content using LWP and HTTP modules behind
    corp firewall. I set proxy server as shown in my internet explorer
    connection setup.
    When i run the script, i got successful response, but the return
    content is not the webpage i requested at all. It shows something
    like:
    -------------------------------------------------
    function FindProxyForURL(url,host) {
    me=myIpAddress();
    if (me == "127.0.0.1") {return "DIRECT";}
    if (host == "127.0.0.1") {return "DIRECT";}
    if (host == "localhost") {return "DIRECT";}
    if (isPlainHostName(host)) {return "DIRECT";}
    .
    .
    .
    ---------------------------------------------------

    Below is my sample script:
    require LWP::UserAgent;
    require HTTP::Request;
     
     my $ua = LWP::UserAgent->new;
     $ua->timeout(10);
     $ua->proxy(['http', 'ftp'], 'http://autoproxy:9090');
     
     my $request = HTTP::Request->new(POST => 'http://www.google.com');
     my $response = $ua->request($request);
     if ($response->is_success) {
        print $response->content; # or whatever
     }
     else {
         die $response->status_line;
     }

    Anyone can help me on this? will appreciate.

    by,
    demon hunter


  • Next message: Gunnar Hjalmarsson: "Re: Perl LWP content request behind firewall and proxy server"