Reputation: 73
I want to submit form data to another url (website on another server) capture the success or failure message (server output) and reply back on the form webpage.
This I want to achieve without letting the user know that the data was actually posted to another website.
echo "
<html>
<body>
<form action ='http://www.example.com/processor.php' method ='POST' >
<input type ='hidden' value ='official' name = 'name'/>
<input type ='hidden' value ='official2' name = 'email'/>
<input type ='hidden' value ='official3' name = 'contactTime'/>
<label for 'other info'> Enter details here </label> <br/>
<textarea rows='4' cols='50' name ='other info' maxlength='200'></textarea>
<input type ='hidden' value ='official4' name = 'legalId'/>
</br>
<input type = 'submit' name = 'submit' value ='Send'/>
</form>
</body>
</html>
";
// I want to send the data to http://example.com/processor.php
?>
I have successfully sent this data to http://example.com/processor.php and success integer "2" was displayed on the page. I don't want this page to be seen by my site visitors. I want to capture this success integer from the other server and display it as a message to the user on my own website.
Upvotes: 1
Views: 3662
Reputation: 1950
I think a good idea would be to look into cURL, you can accept the data into a PHP form then use cURL to call the remote site with the $_POST data, reading the information back.
There is a good tutorial here: http://davidwalsh.name/curl-post
Upvotes: 0
Reputation: 10327
Don't submit your form to the http://example.com/processor.php directly. Submit the form to your own file, which should do the following:
Upvotes: 1