Perl: LWP + proxy + авторизация
Возникла необходимость грабить и парсить одну страничку, находясь в локальной сети с MS Windows Server Active Directory и через прокси (в моем случе - это MS ISA-Server).
Дано:
пользователь - user000
домен - trand
пароль - passWooRDa
адрес прокси - 10.35.10.100
порт прокси - 8080
Код:
Взято отсюда: http://wombat-house.blogspot.com/2010/01/perl-lwp-proxy.html
Дано:
пользователь - user000
домен - trand
пароль - passWooRDa
адрес прокси - 10.35.10.100
порт прокси - 8080
Код:
#!/usr/bin/perl -w
use strict;
use LWP::UserAgent;
my $proxy = 'http://10.35.10.100:8080/';
my $url = "http://www.bank.gov.ua/Fin_ryn/OF_KURS/Currency/FindByDate.aspx";
my $username = 'trand\user000';
my $password = 'passWooRDa';
my $ua = new LWP::UserAgent;
$ua->agent("Mozilla/6.0");
$ua->proxy('http',$proxy);
my $req = new HTTP::Request GET => $url;
$req->proxy_authorization_basic($username, $password);
my $res = $ua->request($req);
my $content='';
if ($res->is_success) {
$content= $res->content;
print $content
}
Взято отсюда: http://wombat-house.blogspot.com/2010/01/perl-lwp-proxy.html
Похожие материалы:
Комментарии:
4 Ноября 2026 (19:15:08)
sakagom918
(гость)
• ответить
Whenever my UK friends ask where to find the best mix of Slingo and classic bingo, I always send them straight to this cheerful brand. Using sun bingo casino allows you to register your profile in under two minutes and unlock brilliant welcome perks in British pounds. In my personal experience, their mobile app and browser site work flawlessly, making it super easy to join a fast 80-ball session or spin video slots anywhere. Create your account right now and enjoy hassle-free payouts!