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

Hello monks!
I'm new to Perl and I'm having my first serious problem:
I have a website with a textarea in it and I want to write a script to recursively fill the textarea of the website and submit the data, without me having to copy-paste the data each time in the textarea.
Are there any modules I could look or something easier you can suggest?
The form in the website uses POST method to send the data and it is something like the following as viewed in the html source (I entered TTTTTTTTTTTTTTT in the textarea as an example of data the user can send):
<form action="show_res.php" method="post"><div> <textarea name="context" rows="10" cols="60">TTTTTTTTTTTTTTTT</tex +tarea> <input name="appid" value="Hub-Finder" type="hidden"> <input value="Submit" type="submit">

Thanks!

Replies are listed 'Best First'.
Re: How to send queries to a website
by kennethk (Abbot) on Sep 10, 2010 at 17:19 UTC

    You can do exactly what you ask quite simply using WWW::Mechanize. Since you are only repeatedly submitting POSTs to a web service, you can accomplish your task with less overhead using LWP::UserAgent as well. Examples in the documentation should provide all the direction you need (WWW::Mechanize::Cookbook, lwpcook).

    I would also comment that the way you've described your issue sounds like abuse. I'm sure that's not what you have in mind, though...

      Is it OK so far?
      use WWW::Mechanize; $url = '.........'; $mech = WWW::Mechanize->new(); $mech->get( $url ); $result = $mech->submit_form ( form_number => 0, fields => { context => 'Hello world', } );

      I'm supposed to get an html file as a response, what can I do to see if was created?