http://www.perlmonks.org?node_id=332126

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

Hi all: I could use some help in submitting a form using perl. Here is what the HTML page and my code look like:
<script language="JavaScript"> function submitScreen(actionStr) { document.verify.action.value = actionStr return true; } </script> <tr><td colspan="2" align="center"> <form name="verify" method="post" action="../download/download.asp"> <input type="hidden" name="action" value="abort"> <input type="submit" name="Continue" value="Yes" onClick=submitScreen( +"continue")> <input type="Submit" name="Abort" value="No" ></td> </tr>
Here is what my perl code so far looks like, but I'm not getting the page I want.
use HTTP::Request::Common qw(POST); use LWP::UserAgent; $ua = LWP::UserAgent->new(); my $req = POST 'http://companyname.com/Customer/support/Patch/releases +/ClientDownload/download/download.asp', [continue => 'Yes']; #$req->content_type('application/x-www-form-urlencoded'); $req->content('match=www&errors=0&action=abort&continue=Yes'); my $res = $ua->request($req); if ($res->is_success) { print $res->content; if ($res->content =~ m/no software is available/) { print "Did not get desired page\n"; } } else { print "Bad luck this time\n";
If my code was working correctly, the page presented by the server would have a set of links to files available for downloading. My intent is to monitor this page and start a download followed by an automated install of the software, followed by an invocation of my automated tests. AdThanksVance