How can I fill out web forms using Perl?

I want to fill out a web form using Perl. I am having trouble finding the right syntax for this. Like in, how can I go to the URL, select the form, fill out the form and press the enter key to make sure it has been submitted?

+3
source share
5 answers
+12
source

WWW :: Mechanize , and his friends are the way to go. There are a few examples in Spidering Hacks , but you will also find much more in the search query for the module name.

Good luck :)

+6
source

WWW:: :: Shell:

perl -MWWW::Mechanize::Shell -e shell
get http://some/page
fillout
...
submit

"script" something.pl - . .

+2
source

Request the URL of the form form using Net::HTTPor something (you can’t remember the exact module) and include the form fields as the GET/ parameter POST(depending on the form).

0
source

HTML :: Form works well too.

Module synopsis is a great example:

 use HTML::Form;
 $form = HTML::Form->parse($html, $base_uri);
 $form->value(query => "Perl");

 use LWP::UserAgent;
 $ua = LWP::UserAgent->new;
 $response = $ua->request($form->click);
0
source

Source: https://habr.com/ru/post/1705942/


All Articles