use proxy authentication with perl
Here is a simple script to grab a URL using proxy that requires authentication and using different port for different service:
use strict;
use LWP::UserAgent;
use HTTP::Request;
my $Silverfox = LWP::UserAgent->new();
$Silverfox->proxy(http =>'http://username:pwd@myproxy.com:8080');
$Silverfox->proxy(ftp =>'username:pwd@http://myproxy.com:81');
$Silverfox->no_proxy(qw('127.0.0.1' local));
# initialize proxy settings from environment variables
#$Sliverfox->env_proxy;
my $req = HTTP::Request->new(GET =>'http://www.bsdplus.cn');
print $Silverfox->request($req)->as_string;
No comments:
Post a Comment