Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??

If you define $ENV{HTTPS_PROXY} = 'http://proxy:8080'; you must NOT declare the proxy to LWP. So the correct code is:

#!/path/to/perl use strict; use LWP::UserAgent; use HTTP::Request::Common; use Crypt::SSLeay; $ENV{HTTPS_PROXY} = 'http://proxy:8080'; $ENV{HTTPS_DEBUG} = 1; my $myurl = "https://www.redhat.com"; my $ua = new LWP::UserAgent; $ua->cookie_jar( {} ); $ua->protocols_allowed( [ 'http','https'] ); # don't use https proxy with LWP! $ua->proxy(['http'], 'http://proxy:8080'); my $page = $ua->get($myurl); die "Error $myurl\n ", $page->status_line, "\n Aborting" unless $page->is_success; print "Success", $page->content_type, " document!\n";

Does this work for you?

Edit: corrected, removing the trailing slash from proxy url


In reply to Re: LWP::Useragent GET fails with https by wazoox
in thread LWP::Useragent GET fails with https by Anonymous Monk

Title:
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?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others surveying the Monastery: (8)
As of 2024-04-18 09:21 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found