Back to index

php5  5.3.10
get.php
Go to the documentation of this file.
00001 <?php
00002   $test = isset($_GET['test']) ? $_GET['test'] : null;
00003   switch($test) {
00004     case 'post':
00005       var_dump($_POST);
00006       break;
00007     case 'getpost':
00008       var_dump($_GET);
00009       var_dump($_POST);
00010       break;
00011     case 'referer':
00012       echo $_SERVER['HTTP_REFERER'];
00013       break;
00014     case 'useragent':
00015       echo $_SERVER['HTTP_USER_AGENT'];
00016       break;
00017     case 'httpversion':
00018       echo $_SERVER['SERVER_PROTOCOL'];
00019       break;
00020     case 'cookie':
00021       echo $_COOKIE['foo'];
00022       break;
00023     case 'encoding':
00024       echo $_SERVER['HTTP_ACCEPT_ENCODING'];  
00025       break;
00026     case 'contenttype':
00027       header('Content-Type: text/plain;charset=utf-8');
00028       break;
00029     case 'file':
00030       if (isset($_FILES['file'])) {
00031           echo $_FILES['file']['name'] . '|' . $_FILES['file']['type'];
00032       }
00033       break;
00034     default:
00035       echo "Hello World!\n";
00036       echo "Hello World!";
00037       break;
00038   }
00039 ?>