perlweb-scrapinguribugzilla

how to pass user data to perl URI object


I'm trying to log in Bugzill through Perl URI and I was not able to pass "Bugzilla_login=@mentor.com&Bugzilla_password= info.

I need to log in because after that I want to webscrape some data from bugzilla.

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

I'm trying to do something like

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

Solution

  • URI just builds a URI object; it doesn't generate an HTTP request. Try LWP::UserAgent and HTTP::Requset instead:

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

    Then you can send the request using LWP::UserAgent.