Hello Monks, I know this is probably something that probably has been asked quite a few times....I have scanned through a lot of documentation ...a lot of queries posted on various groups etc..But still not able to get through this issue with the proxy on my network. Also the requests are Websensed. Here is a sample script I picked up from the code snippets on perl monks .... but this doesnt work...
#!/usr/bin/perl -w # dget.pl # pod at tail use strict; use LWP::UserAgent; use Getopt::Long; use Pod::Usage; use URI::URL; use LWP::Debug qw(+); my ($opt_help, $opt_man); GetOptions( 'help!' => \$opt_help, 'man!' => \$opt_man, ) or pod2usage(-verbose => 1) && exit; pod2usage(-verbose => 1) && exit if (defined $opt_help); pod2usage(-verbose => 2) && exit if (defined $opt_man); # Begin config parameters my %parm = ( url => shift, outfile => shift, uatimeout => 120, # seconds before giving up on fetch browser => 'Mozilla/5.0 (X11; U; Linux i686; en-US; rv:0.9.9) Geck +o/20020310 ', ); my %proxy = ( host => 'http://proxy.mycomp.com:8080', # http://host.dom:port id => 'mynw\mylogin', # ntdom\userid pass => 'mypasswd', # empty quotes if no proxy auth ); # End config parameters unless(defined $parm{url}) { print "\n Ooot - you forgot to provide a URL !\n"; Ooot(); } unless(defined $parm{outfile}) { print "\n Ooot - your forgot to provide an outfile !\n"; Ooot(); } print "\n Fetching $parm{url}...\n"; my $ua = new LWP::UserAgent; $ua->agent($parm{browser}); $ua->timeout($parm{uatimeout}); $ua->proxy(http => "$proxy{host}") if (defined $proxy{host}); $parm{url} = new URI::URL($parm{url}); my $req = new HTTP::Request "GET" => ($parm{url}); $req->proxy_authorization_basic ($proxy{id}, $proxy{pass}) if (defined $proxy{id}); my $res = $ua->request($req); if ($res -> is_success) { my $rescont = $res->content; open (OUT, ">$parm{outfile}") or die "Error opening $parm{outfile} for write: $!"; print OUT $rescont; close OUT or die "Error closing $parm{outfile}: $!"; } else { my $resmsg = $res->message; print "Error fetching $parm{url}:\n $resmsg\n\n"; exit; } print " Done! Page saved at '$parm{outfile}'\n\n"; sub Ooot { print "\n dget.pl --help", "\n dget.pl --man", "\n", "\n LWP $LWP::VERSION", "\n Perl $]", "\n OS $^O", "\n Program $0", "\n\n", ; exit; } Outputs the following : D:\testperl>perl dget.pl http://google.com out.txt Fetching http://google.com... LWP::UserAgent::new: () LWP::UserAgent::proxy: http http://proxy.mycomp.com:8080 LWP::UserAgent::request: () LWP::UserAgent::send_request: GET http://google.com/ LWP::UserAgent::_need_proxy: Proxied to http://proxy.mycomp.com:8080 LWP::Protocol::http::request: () LWP::Protocol::collect: read 623 bytes LWP::Protocol::collect: read 1754 bytes LWP::UserAgent::request: Simple response: Proxy Authentication Require +d Error fetching http://google.com/: Proxy Authentication Required ( The ISA Server requires authorizatio +n to fulfi ll the request. Access to the Web Proxy service is denied. )
Please guide me to the right issue behind this.

In reply to LWP and proxy by Anonymous Monk

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.