Skip to content

Instantly share code, notes, and snippets.

@m42e
Created January 2, 2015 15:33
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save m42e/2d1fce8dd993a95e5439 to your computer and use it in GitHub Desktop.
Save m42e/2d1fce8dd993a95e5439 to your computer and use it in GitHub Desktop.
GET2POST in PHP
<?
$url = $_GET['URL2GO'];
unset($_GET['URL2GO']);
$data = $_GET;
$options = array(
'http' => array(
'header' => "Content-type: application/x-www-form-urlencoded\r\n",
'method' => 'POST',
'content' => http_build_query($data),
),
);
$context = stream_context_create($options);
$result = file_get_contents($url, false, $context);
echo $result;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment