Instantly share code, notes, and snippets.

Embed
What would you like to do?
Rewrite POST data
<?php
if($_POST) {
$postdata = http_build_query($_POST);
$opts = array('http' =>array('method' => 'POST', 'header' => 'Content-type: application/x-www-form-urlencoded', 'content' => $postdata));
$context = stream_context_create($opts);
$result = file_get_contents("https://mynewdomain.com$_SERVER[REQUEST_URI]", false, $context);
echo $result;
} else {
header("Location: https://mynewdomain.com$_SERVER[REQUEST_URI]");
exit();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment