verma_aditya1 has asked for the wisdom of the Perl Monks concerning the following question:

Hi Monks,

I am trying to submit a web form using LWP::UserAgent with some form fields. I can the form data and url using "post" method.

But, I have to pass user credentials also for authentication using "authorization_basic" method of "HTTP::Request" and then submitting request using "request" method but here I am not able to pass the form data. my code is like:

my $ua = LWP::UserAgent->new;
my $req = HTTP::Request->new('POST', 'http::/someurl.com');
$req->authorization_basic('userid', 'password');

my $res = $ua->request( $req );

Please guide me how do I pass form fields (list of key/value pair) in this process.

Thanks,

Adi

Replies are listed 'Best First'.
Re: LWP request with form fields
by Anonymous Monk on Dec 26, 2007 at 10:59 UTC

      Also, WWW::Mechanize, which is the same thing, but with all the work done for you already.

      -Paul