Jump to content

[SOLVED] redirect POST


jagoan-neon

Recommended Posts

Hi, i know how to redirect and passing variable (GET method) using header(), but I wonder how to redirect passing variable using POST between files?

 

my url : hxxp://19.19.19.1/tes.php

passing using GET to hxxp://19.19.19.2/result.php

using this function inside tes.php

<?
header( "hxxp://19.19.19.2/result.php?data=1&user=my&item=10" );
?>

We can see the result at hxxp://19.19.19.2/result.php?data=1&user=my&item=10

 

Does anyone know to do this using POST? passing variable beetween files?

Link to comment
https://forums.phpfreaks.com/topic/114056-solved-redirect-post/
Share on other sites

You can't force the person's browser to post like that. If the two pages were on the same server, you could just store the variables in a session. But, since they are on different servers, you will have to have the server post the data for them. You can accomplish this via the cURL module: http://php.net/curl

 

note: Since the server is doing the posting, no session or cookie info from the user will be available to the page you are posting.

Link to comment
https://forums.phpfreaks.com/topic/114056-solved-redirect-post/#findComment-586274
Share on other sites

session & cookies are on a PER HOST basis....you won't be able to use them if the hostnames (aka IP address) is different.

 

the process for doing what you want is:

1) User navigates to http://19.19.19.1/tes.php

2) User fills out form and submits to hxxp://19.19.19.1/tes.php

3) Server 19.19.19.1 sends data to hxxp://19.19.19.2/result.php for the user via a cURL post

4) Server 19.19.19.1 shows user a thank you page

 

Step 3 could be via a GET too, since the user will never see the URL

Link to comment
https://forums.phpfreaks.com/topic/114056-solved-redirect-post/#findComment-587575
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.