in reply to Connection through a proxy
The page is now stored in $response, to do with as you please.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
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Connection through a proxy
by mce (Curate) on Apr 26, 2004 at 13:35 UTC | |
by TwistedGreen (Sexton) on Apr 26, 2004 at 14:27 UTC | |
|
Re: Re: Connection through a proxy
by mpolo (Chaplain) on Apr 26, 2004 at 15:31 UTC |