forked from php/php-src
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathget.inc
54 lines (54 loc) · 1.4 KB
/
get.inc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
<?php
$test = isset($_GET['test']) ? $_GET['test'] : null;
switch($test) {
case 'post':
var_dump($_POST);
break;
case 'input':
var_dump(file_get_contents('php://input'));
break;
case 'getpost':
var_dump($_GET);
var_dump($_POST);
break;
case 'referer':
echo $_SERVER['HTTP_REFERER'];
break;
case 'useragent':
echo $_SERVER['HTTP_USER_AGENT'];
break;
case 'httpversion':
echo $_SERVER['SERVER_PROTOCOL'];
break;
case 'cookie':
echo $_COOKIE['foo'];
break;
case 'encoding':
echo $_SERVER['HTTP_ACCEPT_ENCODING'];
break;
case 'contenttype':
header('Content-Type: text/plain;charset=utf-8');
break;
case 'file':
if (isset($_FILES['file'])) {
echo $_FILES['file']['name'] . '|' . $_FILES['file']['type'] . '|' . $_FILES['file']['size'];
}
break;
case 'string_file':
if (isset($_FILES['file'])) {
if ($_FILES['file']['error'] === UPLOAD_ERR_OK) {
echo $_FILES['file']['name'] . '|' . $_FILES['file']['type'] . '|' . md5_file($_FILES['file']['tmp_name']);
} else {
echo 'error:' . $_FILES['file']['error'];
}
}
break;
case 'method':
echo $_SERVER['REQUEST_METHOD'];
break;
default:
echo "Hello World!\n";
echo "Hello World!";
break;
}
?>