Connecting Tech Pros Worldwide Forums | Help | Site Map

Redirect with POST

ania.malicka85@gmail.com
Guest
 
Posts: n/a
#1: Jul 20 '08
Hello,

I am playing with automatic redirection with PHP. As with GET is
fairly simple (<meta http-equiv="refresh" content="3;url="http://
www.google.com/search?q=php">

how can I do similar thing with POST (lets assume that I want to add q
= php to post variables). How can I do this?

regards, Ann

macca
Guest
 
Posts: n/a
#2: Jul 21 '08

re: Redirect with POST


You cant.

If you want to pass POST variables to a page you either have to post
them, as in submit a form, or use cURL through PHP.
ania.malicka85@gmail.com
Guest
 
Posts: n/a
#3: Jul 21 '08

re: Redirect with POST


Hello,
Quote:
If you want to pass POST variables to a page you either have to post
them, as in submit a form, or use cURL through PHP.
Thank you! I tried both methods, but:
- when I used html form, I must click a button to proceed (and I want
automatic redirection after 5 seconds). Can I simulate somehow submit
click on this form?

- when I used cURL functions (e.g. saved in file redirect.php) and
want to pass POST variables to show.php it works okay (to delay I used
sleep(5), but in the browser the original url (redirect.php) is saved
and not changed to show.php. Any idea how to make that change?

Regards, Ann
The Natural Philosopher
Guest
 
Posts: n/a
#4: Jul 21 '08

re: Redirect with POST


ania.malicka85@gmail.com wrote:
Quote:
Hello,
>
Quote:
>If you want to pass POST variables to a page you either have to post
>them, as in submit a form, or use cURL through PHP.
>
Thank you! I tried both methods, but:
- when I used html form, I must click a button to proceed (and I want
automatic redirection after 5 seconds). Can I simulate somehow submit
click on this form?
>
Yes. Javascript can execute a submit operation. Ni odea how to time it tho.

Quote:
- when I used cURL functions (e.g. saved in file redirect.php) and
want to pass POST variables to show.php it works okay (to delay I used
sleep(5), but in the browser the original url (redirect.php) is saved
and not changed to show.php. Any idea how to make that change?
>
Never used CURL - pass. In javascript the problem is soluble p[retty simply.
Quote:
Regards, Ann
Ulf Kadner
Guest
 
Posts: n/a
#5: Jul 21 '08

re: Redirect with POST


ania.malicka85@gmail.com wrote:
Quote:
I am playing with automatic redirection with PHP. As with GET is
fairly simple (<meta http-equiv="refresh" content="3;url="http://
www.google.com/search?q=php">
>
how can I do similar thing with POST (lets assume that I want to add q
= php to post variables). How can I do this?
You have to save youre submited Post-Data into the Session. After
Redirection you can access it there.

So long, Ulf
Michael Fesser
Guest
 
Posts: n/a
#6: Jul 21 '08

re: Redirect with POST


..oO(ania.malicka85@gmail.com)
Quote:
>I am playing with automatic redirection with PHP. As with GET is
>fairly simple (<meta http-equiv="refresh" content="3;url="http://
>www.google.com/search?q=php">
This is not a redirect. Proper redirects are done on HTTP level with
appropriate status codes. The above is an abuse of the meta element and
a good way to break the browser's back button. Don't do that.
Quote:
>how can I do similar thing with POST (lets assume that I want to add q
>= php to post variables). How can I do this?
HTTP doesn't allow this. Use a session to pass the data to another page
or, if it's a completely different site, have the user invoking the
submit by pressing a submit button.

Micha
Closed Thread