如何将用户数据传递给perl URI对象

时间:2013-09-25 13:05:27

标签: perl web-scraping uri bugzilla

我正在尝试通过Perl URI登录Bugzill而我无法通过 “Bugzilla_login=@mentor.com& Bugzilla_password = info。

我需要登录,因为之后我想从bugzilla中抓取一些数据。

my $data = $scraper->scrape(
my $uri=URI->new('http://prdbugzilla.wv.mentorg.com/bugzilla/show_bug.cgi?id=22444')
);

我正在尝试做类似

的事情
curl --data "Bugzilla_login=USER&Bugzilla_password=PASSWORD"  http://prdbugzilla.wv.mentorg.com/bugzilla/show_bug.cgi?id=19971

1 个答案:

答案 0 :(得分:3)

URI只是构建一个URI对象;它不会生成HTTP请求。请改为LWP::UserAgentHTTP::Requset

my $req = HTTP::Request->new( POST => 'http://...' );
$req->content('Bugzilla_login=USER&Bugzilla_password=PASSWORD');

然后您可以使用LWP::UserAgent发送请求。