Skip to content

Instantly share code, notes, and snippets.

@mondalaci
Created March 30, 2014 02:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mondalaci/9866402 to your computer and use it in GitHub Desktop.
Save mondalaci/9866402 to your computer and use it in GitHub Desktop.
Posts a form based on the GET parameters and a URL supplied to the script.
<?php
$url = $_GET["url"];
$args = explode("|", $_GET["args"]);
?>
<html>
<head>
<title>GET to POST</title>
</head>
<body onload="document.form.submit()">
<form name="form" action="<?php echo $url ?>" method="post">
<?php
foreach ($args as $arg) {
$i = strpos($arg, "=");
$name = substr($arg, 0, $i);
$value = substr($arg, $i+1);
print "<input type=\"hidden\" name=\"$name\" value=\"$value\">\n";
}
?>
</form>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment