Skip to content

Instantly share code, notes, and snippets.

@schnabear
Created November 15, 2016 08:02
Show Gist options
  • Save schnabear/545e46cdfd02dd330880e20a45338bf7 to your computer and use it in GitHub Desktop.
Save schnabear/545e46cdfd02dd330880e20a45338bf7 to your computer and use it in GitHub Desktop.
PUT GET PHP
<?php
if ($_SERVER['REQUEST_METHOD'] == 'GET') {
// $_SERVER['QUERY_STRING']
echo $_GET['foo'];
echo $_GET['bar'];
} elseif ($_SERVER['REQUEST_METHOD'] == 'PUT') {
parse_str(file_get_contents("php://input"), $_PUT);
echo $_PUT['foo'];
echo $_PUT['bar'];
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment