HummingBirdAnimeClient/frontEndSrc/test/ajax.php
Timothy J. Warren dee4a2dad5
All checks were successful
timw4mail/HummingBirdAnimeClient/pipeline/head This commit looks good
Fix tests for PHP8...?
2020-12-11 14:26:54 -05:00

34 lines
501 B
PHP

<?php
$verb = strtolower($GLOBALS['_SERVER']['REQUEST_METHOD']);
// Send request method if nothing else is specified
if (empty($_GET))
{
echo $verb;
}
else if (isset($_GET['data']))
{
switch($verb)
{
case "get":
$var =& $_GET;
break;
case "post":
$var =& $_POST;
break;
default:
parse_str(file_get_contents('php://input'), $var);
break;
}
header('Content-type: application/json');
echo json_encode($var);
}
else if (isset($_GET['bad']))
{
http_response_code('401');
}