Hi guys, recently I've been trying to do a perl script to automate a form POST on a coldfusion server, however I don't know if the variables are treated in a diferent way than in a CGI script, this is the code I've been using and the HTML data. The important tags of html:
<input type="radio" name="KompressorVote" value="220"> <input type="radio" name="KompressorVote" value="221"> <form action="results.cfm" method="post" name="KompressorPollsForm" id +="KompressorPollsForm"><input type="hidden" name="kact" value="">
Also, I've noticed another that there's javascript involved in this mess:
<a href="javascript:applyVotes()"><img src="el/submit_button.gif" alt= +"Accept" border="0"></a> <script language="JavaScript"> function applyVotes() { window.open ("","ApplyVote","width=400,height=300,toolbar=no,locat +ion=no,directories=no,status=no,scrollbars=yes,resizable=no,copyhisto +ry=no"); document.KompressorPollsForm.target = "ApplyVote" document.KompressorPollsForm.action = "results.cfm" document.KompressorPollsForm.kact.value = "applyVote" document.KompressorPollsForm.submit(); } function showLastPoll() { window.open ("","ApplyVote","width=400,height=300,toolbar=no,locat +ion=no,directories=no,status=no,scrollbars=yes,resizable=no,copyhisto +ry=no"); document.KompressorPollsForm.target = "ApplyVote" document.KompressorPollsForm.action = "results.cfm" document.KompressorPollsForm.kact.value = "showLastPoll" document.KompressorPollsForm.submit(); } </script>
So, what I'm trying to do is to POST the value "220" into results.cfm, so that it gets registered, with no success though, all I get is the same webpage where I'm supposed to select an option. This is the code I've been using:
#!/usr/bin/perl use HTTP::Request::Common qw(POST); use LWP::UserAgent; $var1="220"; $button="kact"; $ua=LWP::UserAgent->new(); my $req= POST 'http://somesite.com/results.cfm', [var1=> $var1,button= +>$button]; $content=$ua->request($req)->as_string; print $content; print $req;
I'm confused right now, afaik this should work.. Any ideas guys?.. Thanks a lot in advance :)

In reply to Form post with Coldfusion by pisteador

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.