I'm trying to make my Perl script access the web at work, through a firewall. I've read the LWP stuff carefully and tried many variations, doublechecked things, etc. Here is an example:
use strict;
use warnings;
require LWP::UserAgent;
my $ua = LWP::UserAgent->new;
$ENV{HTTP_proxy_pass}='xxxxxxxx';
$ua->env_proxy();
my $URL="http://www.dlugosz.com";
my $request = HTTP::Request->new('GET', $URL);
my $response = $ua->request($request);
print "Code: ", $response->code(), ".\n";
print "Content type: ", $response->headers()->content_type(), ".\n";
print $response->content();
I get back content telling me to try the password again, with a code 407. I tried setting the $ENV variables within the script as shown to make sure the shell wasn't munging my characters when I put them in the environment. The username is clear. I tried variations on the proxy name, such as leaving off the http:// part, but that doesn't get as far—since I'm getting a message from the proxy, I figure that must be to its liking.
Window NT 4.0 SP6a, ActiveState Perl build 626
Anything else I should try?
—John
Edit: chipmunk 2001-05-31
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: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.