tags:

views:

75

answers:

2

I need to cause a user's browser to post data using PHP to another site.

Example: You go to start.com/auto-login-hack (via GET)... then PHP sets the right headers etc. and causes the browser to, via POST, go to 3rdparty.com/login.php with login credentials.

I have done this is the past by having an HTML form and an onload script that submits the form to the destination.

I don't know enough about headers and etc. Is this possible? Can anyone link an example? My search skills just turned up how to use $_POST.

Thanks.

+3  A: 

You cannot redirect to a POST; this is a limitation of HTTP. You'd have to use JavaScript to cause the browser to post a form.

David Pfeffer
+5  A: 

Yes, you can submit POST requests from PHP.

One of your choices is to use curl as shown in this SO question.

However, you cannot do redirects.

Peter Bailey