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
-
Are you posting in the right place? Check out Where do I post X? to know for sure.
-
Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
<code> <a> <b> <big>
<blockquote> <br /> <dd>
<dl> <dt> <em> <font>
<h1> <h2> <h3> <h4>
<h5> <h6> <hr /> <i>
<li> <nbsp> <ol> <p>
<small> <strike> <strong>
<sub> <sup> <table>
<td> <th> <tr> <tt>
<u> <ul>
-
Snippets of code should be wrapped in
<code> tags not
<pre> tags. In fact, <pre>
tags should generally be avoided. If they must
be used, extreme care should be
taken to ensure that their contents do not
have long lines (<70 chars), in order to prevent
horizontal scrolling (and possible janitor
intervention).
-
Want more info? How to link
or How to display code and escape characters
are good places to start.
|