开发者

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

开发者 https://www.devze.com 2022-12-11 00:35 出处:网络
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?I re

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?


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


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().

0

精彩评论

暂无评论...
验证码 换一张
取 消