Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
PerlMonks  

Re^3: WWW::Mechanize with https and a proxy

by justinm1 (Initiate)
on Oct 10, 2007 at 14:09 UTC ( [id://643963]=note: print w/replies, xml ) Need Help??


in reply to Re^2: WWW::Mechanize with https and a proxy
in thread WWW::Mechanize with https and a proxy

Just an FYI, I've found I definitly need the SSLeay and env variable setting, otherwise it hangs (so I can confirm the above statement). At least I get something back when I include them, even if it is a 400 error. If this script works for others without a proxy, then I can only assume it's something wonky with our proxy, which is a bummer. I'll ping the internal help group again and report back if there's an update.
  • Comment on Re^3: WWW::Mechanize with https and a proxy

Replies are listed 'Best First'.
Re^4: WWW::Mechanize with https and a proxy
by Anonymous Monk on Apr 03, 2009 at 15:22 UTC

    OK, I just spent two hours figuring this out. Make sure you are using ssleay (not openssl)

    Here is the code to properly setup mechanize to use a private proxy:

    use WWW::Mechanize;
    my $proxy='proxy.host.net:8080';
    my $proxy_user='proxy_username';
    my $proxy_pass='proxy_password';
    $ENV{HTTPS_PROXY} = 'http://'.$proxy;
    $ENV{HTTPS_PROXY_USERNAME} = $proxy_user;
    $ENV{HTTPS_PROXY_PASSWORD} = $proxy_pass;
    my $mech = WWW::Mechanize->new();
    $mech->agent('Mozilla/5.0');
    $mech->proxy('http', 'http://'.$proxy_user.':'.$proxy_pass.'@'.$proxy);
    $mech->proxy('https', undef);
    $mech->get('https://www.somehost.com/');
    

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://643963]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others having an uproarious good time at the Monastery: (5)
As of 2024-04-25 17:09 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found