Created
February 24, 2017 20:43
-
-
Save robertstaddon/db98d8c8d87746730a18b2a8d0b55144 to your computer and use it in GitHub Desktop.
Rewrite POST data
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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