jagoan-neon Posted July 10, 2008 Share Posted July 10, 2008 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 More sharing options...
rhodesa Posted July 10, 2008 Share Posted July 10, 2008 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 More sharing options...
Guest Xanza Posted July 10, 2008 Share Posted July 10, 2008 Yea, sessions and cookies are a lifesaver. Link to comment https://forums.phpfreaks.com/topic/114056-solved-redirect-post/#findComment-586288 Share on other sites More sharing options...
jagoan-neon Posted July 11, 2008 Author Share Posted July 11, 2008 Thanks, now I have to learn about session or cookies... Link to comment https://forums.phpfreaks.com/topic/114056-solved-redirect-post/#findComment-587238 Share on other sites More sharing options...
rhodesa Posted July 11, 2008 Share Posted July 11, 2008 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 More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.