searls03 Posted March 30, 2013 Share Posted March 30, 2013 this may be a vague question, but is there a way for PHP to generate a POST variable and then send that variable to a page on a different server? so PHP creates lets say a POST variable for "name" (this should be equivalent to an html form with the name of "name"), so then it can submit to a form on an external server that only accepts specific names of elements? does this make sense? Quote Link to comment https://forums.phpfreaks.com/topic/276331-passing-post-variables/ Share on other sites More sharing options...
PaulRyan Posted March 30, 2013 Share Posted March 30, 2013 You'd want to look into curl Quote Link to comment https://forums.phpfreaks.com/topic/276331-passing-post-variables/#findComment-1422006 Share on other sites More sharing options...
searls03 Posted March 30, 2013 Author Share Posted March 30, 2013 Wish I could, but I need a way where it will actually go to the page with the posted variable present. So the same page an HTML form would go to. Quote Link to comment https://forums.phpfreaks.com/topic/276331-passing-post-variables/#findComment-1422007 Share on other sites More sharing options...
PaulRyan Posted March 30, 2013 Share Posted March 30, 2013 Well in that case, I don't think there is a way to do it solely by PHP. You would need a form, with the method of POST, then submit that form by JavaScript or a manual submit button click. Someone else may come up with something, but I can't think of anything. Quote Link to comment https://forums.phpfreaks.com/topic/276331-passing-post-variables/#findComment-1422008 Share on other sites More sharing options...
searls03 Posted March 30, 2013 Author Share Posted March 30, 2013 and I don't want to do it via a form because it would contain prepopulated sensitive info Quote Link to comment https://forums.phpfreaks.com/topic/276331-passing-post-variables/#findComment-1422009 Share on other sites More sharing options...
mac_gyver Posted March 30, 2013 Share Posted March 30, 2013 what you are asking is exactly what curl does. it requests pages exactly the same as a browser would. you would use it to submit post data to the form processing page. the same as a html form in a browser would have. Quote Link to comment https://forums.phpfreaks.com/topic/276331-passing-post-variables/#findComment-1422010 Share on other sites More sharing options...
PaulRyan Posted March 30, 2013 Share Posted March 30, 2013 @mac_gyver, he wants to actually go to the page he is POST-ing to, not do the POST in the background and return the website. This is very similar to another question on here, both of which haven't been solved. Quote Link to comment https://forums.phpfreaks.com/topic/276331-passing-post-variables/#findComment-1422017 Share on other sites More sharing options...
Jessica Posted March 31, 2013 Share Posted March 31, 2013 So create a PHP (or html) file with a form, and make the action the page you want to go to. Quote Link to comment https://forums.phpfreaks.com/topic/276331-passing-post-variables/#findComment-1422020 Share on other sites More sharing options...
PaulRyan Posted March 31, 2013 Share Posted March 31, 2013 @Jessica: and I don't want to do it via a form because it would contain prepopulated sensitive info Quote Link to comment https://forums.phpfreaks.com/topic/276331-passing-post-variables/#findComment-1422022 Share on other sites More sharing options...
trq Posted March 31, 2013 Share Posted March 31, 2013 @mac_gyver, he wants to actually go to the page he is POST-ing to, not do the POST in the background and return the website.Which again, is exactly what curl does. Quote Link to comment https://forums.phpfreaks.com/topic/276331-passing-post-variables/#findComment-1422026 Share on other sites More sharing options...
searls03 Posted March 31, 2013 Author Share Posted March 31, 2013 Which again, is exactly what curl does. no, cURL stays on current page Quote Link to comment https://forums.phpfreaks.com/topic/276331-passing-post-variables/#findComment-1422027 Share on other sites More sharing options...
trq Posted March 31, 2013 Share Posted March 31, 2013 Your doing it wrong. You need to read up on and get a basic understanding of what http is and how it works before you start telling people with experience that they are wrong. There is no such thing as "going to a page" in http. You make a request, the server sends you a response. Until you understand some basics, your own your own. Quote Link to comment https://forums.phpfreaks.com/topic/276331-passing-post-variables/#findComment-1422029 Share on other sites More sharing options...
moltm4785 Posted March 31, 2013 Share Posted March 31, 2013 Why don't you use ajax with jquery I'm pretty sure there is a way to do cross site interaction. Quote Link to comment https://forums.phpfreaks.com/topic/276331-passing-post-variables/#findComment-1422030 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.