HummingBirdAnimeClient/frontEndSrc/test/ajax.php

34 lines
501 B
PHP
Raw Normal View History

2016-02-10 12:25:13 -05:00
<?php
2020-12-11 14:26:54 -05:00
$verb = strtolower($GLOBALS['_SERVER']['REQUEST_METHOD']);
2016-02-10 12:25:13 -05:00
// 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');
}