How do I send a POST request with PHP?

前端 未结 13 1607
暗喜
暗喜 2020-11-21 05:40

Actually I want to read the contents that come after the search query, when it is done. The problem is that the URL only accepts POST methods, and it does not t

13条回答
  •  梦谈多话
    2020-11-21 05:55

    I was looking for a similar problem and found a better approach of doing this. So here it goes.

    You can simply put the following line on the redirection page (say page1.php).

    header("Location: URL", TRUE, 307); // Replace URL with to be redirected URL, e.g. final.php
    

    I need this to redirect POST requests for REST API calls. This solution is able to redirect with post data as well as custom header values.

    Here is the reference link.

提交回复
热议问题