Update: This is NOT a duplicate of How do I send a POST request with PHP?. The solutions there don't work for me, they just output the result of the request, I don't want to do this, I want to send the user to the external site, it is secure website for credit card payment processing.
Update 2: I've added a diagram below to try and clearly explain what I'm trying to do
Here's what I'm trying to do:
- a html form is submitted to a php script
- the php script does some processing on the data and then submits data via POST request to an external website
- I do not want to receive the result of the POST request in my PHP script, instead I just want to send the user to the external site where they see the result of the POST
I'm thinking curl is not suitable for this task as I'm not interested in receiving the result of the request back, I just want to send the user to the next site just as if they submitted the form directly.
To put this another way, I want to submit a form to an external website but I want to submit it to my own script first so I can process the data and send email notifications and then submit onwards to the external website with some new calculated data added.
One way I can think of doing this is to output the new form output as hidden fields along with javascript to auto-submit the form but there has got to be a more straightforward, robust way to do it without relying on javascript. Maybe by manipulating headers, or maybe there is already a php function to simply submit a post request and redirect to the result?

Источник: https://stackoverflow.com/questions/323 ... p-redirect