Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Re: Submitting a form

by saintmike (Vicar)
on Feb 26, 2004 at 23:07 UTC ( #332140=note: print w/replies, xml ) Need Help??


in reply to Submitting a form

Looks like you're using continue=Yes in your request but the HTML form will use Continue=Yes (uppercase). Also, why are you using both POST and content()?
POST 'http://somewhere/foo', [action => "abort", Continue => "Yes"]);
should suffice.

Replies are listed 'Best First'.
Re: Re: Submitting a form
by muradkhan (Initiate) on Feb 27, 2004 at 00:15 UTC
    SaintMike, thank you for responding. the HTML I've displayed is what is coming back from the server when I get past the login page. I'm trying to accomplish in perl what my mouse and fingers do when I click the 'Yes' button. I read somewhere that in calling the Javascript as I have it, the parameter "continue" gets created (lower case). what does this mean ?
    [action => "abort", Continue => "Yes"]
    I'm guessing it's an assignment. The Perl Cookbook seems to use single quotes. Does it matter. Murad
      Just checked, if you press the "yes" button, the browser sends
      * action o continue * Continue o Yes

      and if you're pressing "no", you get
      * action o continue * Abort o No

      So, in your code, you need to say
      POST 'http://companyname.com/Customer/support/Patch/releases /ClientDownload/download/download.asp', [action => "continue", Continue => "Yes"];

      to create a HTTP::Request object simulating the "Yes". Check out the documentation on HTTP::Request::Common -- the POST function expects a URL and a reference to an array containing key-value pairs of CGI parameters you want to pass.

      If you want to figure out what a browser sends to a server, there's a simple trick: Put a cgi-dump script like

      use CGI qw/:standard/; my($self) = CGI::self_or_CGI(); print header(), start_html('-title' => "CGI Dump", '-BGCOLOR' => "white"), h2("Query Parameters:"), CGI::as_string(), h2("Environment:"), (map { p("$_ => $ENV{$_}") } sort keys %ENV), end_html();

      into a cgi-bin directory of a web server you have control over (it can even be on your local machine). Then, save the HTML of the form you're testing to a local file, and replace its action-URL by the URL to the CGI script on your server (e.g. http://localhost/cgi-bin/dump.cgi). If you then load the local HTML form file into the browser (File->OpenFile) and click on the submit button, the browser will contact your server with the dump-script above and show which parameters have actually been submitted -- this way, you don't need to worry about JavaScript, because the browser takes care of it.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://332140]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others avoiding work at the Monastery: (3)
As of 2021-04-18 13:51 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?