php/e05GetServer.php
<html>
<head>
<title>PHP Test e05GetServer</title>
</head>
<body>
<h2>Output</h2>
<?php echo '<p>Hello Walter von' . __file__ . '</p>';
echo '<p>getcwd = ' . getcwd() . '</p>';
myList($_GET, '$_GET');
echo "\n<p>\$_SERVER['QUERY_STRING'] ===> " . ($_SERVER['QUERY_STRING'] ?? '---undefined---');
echo '<br> ... urldecode ===> ' . urldecode($_SERVER['QUERY_STRING']);
echo '<br> ... split [&\s]+ ===> ' . '[' . implode(', ',preg_split('/[&\s]+/', urldecode($_SERVER['QUERY_STRING']))) . ']';
# . '</p>';
myList($_POST, '$_POST');
myList($_SERVER, '$_SERVER');
is_callable('getallheaders') ? myList(getallheaders(), 'getallheaders()') : (function () {echo "\n<br>getallheaders() ---undefined";})();
$ii = file_get_contents('PHP://INPUT');
echo "\n<br>file_get_contents('PHP://INPUT') len " . strlen($ii) . "<code>$ii</code>";
echo "\n<br>http_get_request_body() ===> install pecl_http first" ; #. (http_get_request_body() ?? ' ---null--- ');
myList($_ENV, '$_ENV');
myList(getenv(), 'getenv()');
echo '<br>getenv(USER) ===> ' . getenv('USER');
echo '<br>getenv(PATH) ===> ' . getenv('PATH');
echo '<br>getenv(PWD) ===> ' . getenv('PWD');
echo '<br>realpath(.) ===> ' . realpath('.');
#session_start();
#myList($_SESSION, '$_SESSION');
echo '<p> print_r $_GET[\'pZwei\'] = '; print_r(isset($_GET['pZwei']) ? $_GET['pZwei'] : 'isset==false' ) . '</p>';
echo '<p> print_r $_GET = '; print_r($_GET) . '</p>'; ;
?>
<h2>Source</h2>
<?php highlight_file( __file__ ) ?>
</body>
</html>
<?php
function myList($a, $t) {
echo "\n<p>$t<ol>";
foreach ($a as $key => $value) {
echo "\n <li>$key ===> $value </li>";
}
echo '</ol> </p>';
}
?>