10legit10quit Posted September 13, 2007 Share Posted September 13, 2007 One PHP file (execute.php) needs to be sent a POST variable to function. Another PHP file (interface.php) provides the user interface for the program. Interface.php needs to communicate with execute.php by making an HTTP request, that includes a POST variable. However, this variable should NOT be accessible to the end user. What should happen is: User loads interface.php Hits a button, POST variable is sent to execute.php without the user being able to see it Execute.php returns content to user, or to interface.php The two scripts cannot be integrated, what is needed is a way to query one (execute.php) with a hidden POST variable, without leaking that variable to the user. Is this possible? Quote Link to comment https://forums.phpfreaks.com/topic/69260-make-php-issue-an-http-request-with-post-form-data-seperate-from-the-user/ Share on other sites More sharing options...
10legit10quit Posted September 13, 2007 Author Share Posted September 13, 2007 Yay Google, think I found what was needed: From http://netevil.org/blog/2006/nov/http-post-from-php-without-curl "here's an example of how to send a POST request with straight up PHP, no cURL:" <?php $postdata = http_build_query( array( 'var1' => 'some content', 'var2' => 'doh' ) ); $opts = array('http' => array( 'method' => 'POST', 'header' => 'Content-type: application/x-www-form-urlencoded', 'content' => $postdata ) ); $context = stream_context_create($opts); $result = file_get_contents('http://example.com/submit.php', false, $context); ?> Quote Link to comment https://forums.phpfreaks.com/topic/69260-make-php-issue-an-http-request-with-post-form-data-seperate-from-the-user/#findComment-348027 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.