Hi, I've seen quite a bit on this topic, both here and around the net, but I'm still having some issues with this code. Basically, this test script is attempting to return the raw html for the site defined below. It works fine for http, but not for https, which returns a 400 error (bad request). I've already set $ENV{HTTPS_PROXY} and am also using Crypt::SSLeay, both recommended fixes I've seen elsewhere. It could be related to the proxy, but I unfortunately can't test it without one (I've changed the actual proxy address for my company due to paranoia). Here's the code:
use strict; $ENV{HTTPS_PROXY} = 'my_proxy:8080'; use HTML::Parser; use WWW::Mechanize; use Crypt::SSLeay; use LWP::Debug qw(+); my $mech = WWW::Mechanize->new(); $mech->agent('Mozilla/5.0'); $mech->proxy(['https', 'http', 'ftp'], 'my_proxy:8080'); # http $mech->get("http://www.google.com"); # https #$mech->get("https://www.cia.gov"); my $c = $mech->content; print $c;
Anything I'm obviously doing wrong here? I've hit a wall with my little project due to this. Any help would be much appreciated...

In reply to WWW::Mechanize with https and a proxy by justinm1

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



  • 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:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.