Will you need to use authentication to get through the proxy? If so, you may run into some difficulties using the usual modules. I have had to use the CPAN module Net::HTTPTunnel instead of any of the LWP::UserAgent modules to do this. An example: use Net::HTTPTunnel;
use HTTP::Request;
my $proxy_host = "192.168.1.1";
my $proxy_port = "83";
my $proxy_user = "username";
my $proxy_pass = "password";
my $ht = Net::HTTPTunnel->new( 'proxy-host' => $proxy_host,
'proxy-port' => $proxy_port,
'remote-host' => 'www.perlmonks.org',
'remote-port' => '80',
'proxy-user' => $proxy_user,
'proxy-pass' => $proxy_pass,
'timeout' => 20);
$ht or die "request timed out";
# generate an HTTP request
my $req = HTTP::Request->new(GET => "http://www.perlmonks.org/index.pl
+?node_id=317556");
print $ht $req->as_string; # print the request to t
+he socket
my $response;
while (<$ht>) {$response .= $_;} # read response (the HTML
+web page) from the socket
close $ht; # close the socket
The page is now stored in $response, to do with as you please.
-
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.
|