Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??
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 = ""; 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' => '', '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 => " +?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.

In reply to Re: Connection through a proxy by TwistedGreen
in thread Connection through a proxy by freak

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

  • 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.
Log In?

What's my password?
Create A New User
Domain Nodelet?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others studying the Monastery: (3)
As of 2024-06-16 05:01 GMT
Find Nodes?
    Voting Booth?

    No recent polls found

    erzuuli‥ 🛈The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.