Search code examples
phphttp-postreusability

How do I post $_POST values


I was wondering if anyone can help with posting $_POST values again. Let's say I post form values to post.php where I can access data by $_POST or $_REQUEST variables. But how can I post $_POST to another url let's say post_one.php and access data there?


Solution

  • If you want to keep the POST data while redirecting the user (i.e., the browser), create a new form containing the POST data (ensure you use htmlspecialchars) and then submit this one (sending it to the new target location).

    If this is totally server side, you can just do a simple POST request with cURL or file_get_contents. php.net has a lot of information about this topic.