xiper,
This looked very promising and tried the code below but get the 502 error. Is their a way of establishing exactly what the proxy is objecting to? I am sure that the domain\username and password are correct.
#!/usr/local/bin/perl
use LWP::UserAgent;
use HTTP::Request;
use HTTP::Response;
use HTTP::Headers;
my $header = HTTP::Headers->new( Proxy_Authorization => 'Basic ZW1lYVx
+yYmlzc2V0OnJvbjQ1Ng==' );
my $ua = new LWP::UserAgent;
#$ua->proxy('http', 'http://domain\username:password@10.10.10.10:8080/
+');
$ua->proxy('http', 'http://10.10.10.10:8080/');
$ua->no_proxy('my_domain.com');
my $request = new HTTP::Request('GET', $ARGV[0], $header);
#$request->proxy_authorization_basic( 'domain\username', 'password' );
my $response = $ua->request($request);
if ($response->is_success) {
print $response->content;
} else {
print $response->error_as_HTML;
}
And this is the error that I am getting
$ perl -d ./get_url.pl http://www.google.co.uk
Loading DB routines from perl5db.pl version 1.19
Editor support available.
Enter h or `h h' for help, or `man perldebug' for more help.
main::(./get_url.pl:8): my $header = HTTP::Headers->new( Proxy_Authori
+zation => 'Basic ZW1lYVxyYmlzc2V0OnJvbjQ1Ng==' );
DB<1> s
HTTP::Headers::new(/usr/local/lib/perl5/site_perl/5.8.0/HTTP/Headers.p
+m:70):
70: my($class) = shift;
DB<1> s
HTTP::Headers::new(/usr/local/lib/perl5/site_perl/5.8.0/HTTP/Headers.p
+m:71):
71: my $self = bless {}, $class;
DB<1> s
HTTP::Headers::new(/usr/local/lib/perl5/site_perl/5.8.0/HTTP/Headers.p
+m:72):
72: $self->header(@_) if @_; # set up initial headers
DB<1> x $header
0 undef
DB<2> r
scalar context return from HTTP::Headers::new: 'proxy-authorization' =
+> 'Basic ZW1lYVxyYmlzc2V0OnJvbjQ1Ng=='
main::(./get_url.pl:10): my $ua = new LWP::UserAgent;
DB<2> r
<HTML>
<HEAD><TITLE>An Error Occurred</TITLE></HEAD>
<BODY>
<H1>An Error Occurred</H1>
502 Proxy Error ( The ISA Server denies the specified Uniform Resource
+ Locator (URL). )
</BODY>
</HTML>
Debugged program terminated. Use q to quit or R to restart,
Any advice appreciated.
rmb
-
Are you posting in the right place? Check out Where do I post X? to know for sure.
-
Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
<code> <a> <b> <big>
<blockquote> <br /> <dd>
<dl> <dt> <em> <font>
<h1> <h2> <h3> <h4>
<h5> <h6> <hr /> <i>
<li> <nbsp> <ol> <p>
<small> <strike> <strong>
<sub> <sup> <table>
<td> <th> <tr> <tt>
<u> <ul>
-
Snippets of code should be wrapped in
<code> tags not
<pre> tags. In fact, <pre>
tags should generally be avoided. If they must
be used, extreme care should be
taken to ensure that their contents do not
have long lines (<70 chars), in order to prevent
horizontal scrolling (and possible janitor
intervention).
-
Want more info? How to link
or How to display code and escape characters
are good places to start.
|