473,394 Members | 2,160 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

Redirecting with POST content

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
Jul 17 '05 #1
3 2291
David E. Smith wrote:
I want to redirect input from one page to another, but it's POST content. (snip) 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.


PHP can POST the data to wherever you want (among other options with
CURL [ http://www.php.net/curl ]), but that is POSTing by the server,
not the client. If you want the client to do that, it might be possible
to achieve with JavaScript.

Once the server POSTs the data and receives some feedback, you can send
that feedback to the user.
So you send a form to the client that posts to your server.
Your server (re)posts that data (possible changed/augmented) to another
script and gets the result page.
This result page is then sent to your client who is yet waiting for an
answer for her POST to your server.

Makes sense?
--
--= my mail box only accepts =--
--= Content-Type: text/plain =--
--= Size below 10001 bytes =--
Jul 17 '05 #2
David E. Smith wrote:
I want to redirect input from one page to another, but it's POST content.


You'll have seen this, but I'm posting it for others' sake:

http://ppewww.ph.gla.ac.uk/~flavell/...-redirect.html

--
Jock
Jul 17 '05 #3
Use Javascript, recreate the form on a blank page with all value filled
using php. then use the js function :
document.formname.submit() at the end of the page, the form is now
automatically submitted when the page is loaded.

Savut

"David E. Smith" <da**@technopagan.org> wrote in message
news:Xn**********************@127.0.0.1...
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


Jul 17 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Didier Degey | last post by:
hi all here is my problem ... i'm working on a network connection project and for the application i use a multi-window system one page for the search form one page for displaying general...
2
by: Paul M | last post by:
hi there, i have an <asp:button> control on my webpage that when clicked, i want to redirect the HTTP request to an EXE file, but instead of actually directing the browser and address bar to...
3
by: tony | last post by:
I've been searching through the threads to find a solution for 401.3 error triggered by windows authentication not being able to redirect to a custom error page to no avail. It seems that ASP.NET...
9
by: Denise | last post by:
I have posted a similar message in 2 other forums but got no response. I have spent more hours than I can count researching this. Can anyone provide some insight...? Our ASP.Net application...
3
by: Shreyas | last post by:
I am a new user writing some scripts to store data entered via a browser into a database. I have several content pages, and one "processing" page. A content page often has a form like this: ...
8
by: Morpheus | last post by:
I am trying to test a function that outputs text to the standard output, presumably using a cout call. I do not have access to the source, but need to test the output. Is this possible? I can...
17
by: mansb2002 | last post by:
Hi, We recently moved our webserver from Win2K to Win2003. The application works fine. Only problem is that when user views a report as a PDF, IE does not show it. The following code is used to...
41
by: amygdala | last post by:
Hello all, I have posted a similar question in comp.lang.php in the past, but haven't had any response to it then. I kinda swept the problem under the rug since then. But I would really like to...
6
by: rpcchandu | last post by:
Hi Coders, I have to redirect from my server to the different server page by simulating the POST method submit from the Controller file, I tried using post_via_redirect, but could not succeed......
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.