Reputation: 1800
I have a proxy with IP, Port, Login and Password. Is it possible to use this proxy with Perl's WWW::Mechanize?
Thanks.
Upvotes: 2
Views: 1766
Reputation: 129423
I'm not sure if there's a native way but here's a workaround which is claimed to work:
http://www.perlmonks.org/?node_id=269358
It's based on setting $ENV{HTTP_PROXY}
to "http://login:password@proxyserver" where both login and password must be URI-encoded.
Also, WWW::Mechanize is a subclass of LWP::UserAgent
, and as such, what works in LWP should work on Mechanize (example from LWP Cookbook, PROXIES section)
use LWP::UserAgent;
$ua = LWP::UserAgent->new;
$ua->proxy(['http', 'ftp'] => 'http://username:[email protected]');
$req = HTTP::Request->new('GET',"http://www.perl.com");
$res = $ua->request($req);
print $res->decoded_content if $res->is_success;
Upvotes: 6