xref: /PHP-5.5/ext/curl/tests/responder/get.php (revision 488e64db)
1<?php
2  $test = isset($_GET['test']) ? $_GET['test'] : null;
3  switch($test) {
4    case 'post':
5      var_dump($_POST);
6      break;
7    case 'getpost':
8      var_dump($_GET);
9      var_dump($_POST);
10      break;
11    case 'referer':
12      echo $_SERVER['HTTP_REFERER'];
13      break;
14    case 'useragent':
15      echo $_SERVER['HTTP_USER_AGENT'];
16      break;
17    case 'httpversion':
18      echo $_SERVER['SERVER_PROTOCOL'];
19      break;
20    case 'cookie':
21      echo $_COOKIE['foo'];
22      break;
23    case 'encoding':
24      echo $_SERVER['HTTP_ACCEPT_ENCODING'];
25      break;
26    case 'contenttype':
27      header('Content-Type: text/plain;charset=utf-8');
28      break;
29    case 'file':
30      if (isset($_FILES['file'])) {
31          echo $_FILES['file']['name'] . '|' . $_FILES['file']['type'];
32      }
33      break;
34    case 'method':
35      echo $_SERVER['REQUEST_METHOD'];
36      break;
37    default:
38      echo "Hello World!\n";
39      echo "Hello World!";
40      break;
41  }
42?>
43