Redirecting with POST content

From: David E. Smith (dave_at_technopagan.org)
Date: 02/18/04


Date: Wed, 18 Feb 2004 20:09:40 -0000

I want to redirect input from one page to another, but it's POST content.
If it were GET, I could just do something like:
header("Location: /new/form.php?a=1&b=2")

I can't rewrite the destination script, because it's proprietary. And
compiled. And for Windows.

A few details might help: I'm using Imail's Web-based email interface on
one site, and the only form inputs available to it are username and
password. The existing form looks like this:

<FORM ACTION="http://dom.ain:8383/login.cgi" METHOD="POST">
<INPUT TYPE="hidden" NAME="page" VALUE="login">
Username: <INPUT TYPE="text" NAME="userid">
Password: <INPUT TYPE="password" NAME="passwd">
<INPUT TYPE="SUBMIT" VALUE="Login">

(Obviously, I've stripped out some of the extraneous HTML markup.)

What I'd like to do is:

* Modify that form so that it POSTs to some hypothetical "login.php" page
* Add an INPUT TYPE="CHECKBOX" NAME="SSL" CHECKED

And have this hypothetical login.php act on the SSL variable, like this
pseudocode:

if((isset($_POST["SSL"])) && ($_POST["SSL"] == TRUE)) {
  redirect (https://dom.ain:8384/);
}
redirect (http://dom.ain:8383);

Where redirect() is some fictitious function that would have to handle
the other two POSTed variables.

Again, if the destination form accepted GET, this would be trivial. It'd
just be a matter of constructing a destination URL and sending a
Location: header.

But I'm not sure how to put all this together with POST, or if it's even
possible.

So, is it possible? Any pointers? I googled this, and found a number of
people asking basically this question, but no good answers.

Thanks!
...dave



Relevant Pages

  • Re: $/ variable trouble
    ... I am using the diamond operator to redirect input to my perl script. ... having it read from STDIN and redirecting the process's STDIN to be ...
    (perl.beginners)
  • Re: redirecting output/input
    ... > FILE.TXT will pass in the contents of file.txt to sort. ... You can never redirect input INTO a file, only to be FROM a file. ... also distinguish internal commands, whose description in HELP tells you ...
    (comp.os.msdos.4dos)
  • Re: Site and Content Rules - Not working
    ... to the user a page containing an explaination on why the destination they ... It seems that ISA can't work out the "all sites ... > "Not a Work Related Site" message, since you can only redirect on a Deny ... >>> the client machines. ...
    (microsoft.public.isa.configuration)
  • Re: Parse .cfm files
    ... Jerry Stuckle wrote: ... You'll be much better off in the long run if you change the extension to ... A 301 redirect takes care of things quite nicely - and permanently. ... One would use rewrite to do that, ...
    (comp.lang.php)
  • Re: .htaccess style rewrite with php
    ... Now that I think of it, you can also rewrite ... files, or pdf files, or .doc files, etc. as that file type. ... do it is redirect to that file, which is not what I want. ... Perhaps what you want to do is read in the file from a protected location and print the header and then the file. ...
    (comp.lang.php)