freakwincy
freakwincy

Reputation: 1267

How do I redirect values from a PHP page to another?

I'm trying to post XML data from a PHP page to another (not necessarily PHP-based) one without a form post. Is it possible to say do a POST via the header() function? If so, how?

Upvotes: 1

Views: 370

Answers (2)

Kaivosukeltaja
Kaivosukeltaja

Reputation: 15735

I recommend using cURL to forward the request. There are lots of examples to help you along on the linked page.

Upvotes: 2

Lars D
Lars D

Reputation: 8563

If client A starts script B, and you want script B to make a POST request to script C, then you need to make script B communicate to script C. This cannot be done using Header(), because it communicates from B to A.

Instead, you need to open a TCP connection to the webserver of script C, and then send the HTTP POST header in that direction. You can use fsockopen to create the connection, and then just send the headers using fwrite().

Upvotes: 1

Related Questions