Is there anyway to pass post data from PHP, with the header function, or with any other method.
Background:-
I've got a form which posts data to a PHP script. The script then validates the data. If there's an error it goes back to the form. If there's no error it does some db updates. I need it to then pass the relivent information to paypal. Paypal take this information in the form of hidden fields in a post form. But I don't want to build a page with the FORM and a 'click here to contiue' button, I want to do it all on the server side with PHP.
Any ideas.
Pass post data from a PHP script.
Moderator: General Moderators
You need to send a POST request to PayPal with your data, thus emulating FORM behavior. There are facilities in cURL and PEAR to do this. If they aren't available to you then you'll have to write custom function for that. Don't worry, someone has already done that. Take a look here.
If you're using php 5 you might also be interested in example M-2 at http://de3.php.net/manual/en/wrappers.http.php
Thanks for your help. I tried it with cURL, but I need the browser to actually go to paypal, rather than be serving the page as if it were on my site.
In the end I used javascript to auto submit the form. I wanted to avoid that, but I guess I need the form submitted by the client not the server and that seemed to be the only way to acheive it.
In the end I used javascript to auto submit the form. I wanted to avoid that, but I guess I need the form submitted by the client not the server and that seemed to be the only way to acheive it.