Forked from Shohan494/getPhpServerVariables.php
Last active
September 6, 2022 20:51
-
-
Save sthembi/9a918c4f5a2abfcd12d852fdeb3646f8 to your computer and use it in GitHub Desktop.
basic php server variables
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$indicesServer = array('PHP_SELF', | |
'argv', | |
'argc', | |
'GATEWAY_INTERFACE', | |
'SERVER_ADDR', | |
'SERVER_NAME', | |
'SERVER_SOFTWARE', | |
'SERVER_PROTOCOL', | |
'REQUEST_METHOD', | |
'REQUEST_TIME', | |
'REQUEST_TIME_FLOAT', | |
'QUERY_STRING', | |
'DOCUMENT_ROOT', | |
'HTTP_ACCEPT', | |
'HTTP_ACCEPT_CHARSET', | |
'HTTP_ACCEPT_ENCODING', | |
'HTTP_ACCEPT_LANGUAGE', | |
'HTTP_CONNECTION', | |
'HTTP_HOST', | |
'HTTP_REFERER', | |
'HTTP_USER_AGENT', | |
'HTTPS', | |
'REMOTE_ADDR', | |
'REMOTE_HOST', | |
'REMOTE_PORT', | |
'REMOTE_USER', | |
'REDIRECT_REMOTE_USER', | |
'SCRIPT_FILENAME', | |
'SERVER_ADMIN', | |
'SERVER_PORT', | |
'SERVER_SIGNATURE', | |
'PATH_TRANSLATED', | |
'SCRIPT_NAME', | |
'REQUEST_URI', | |
'PHP_AUTH_DIGEST', | |
'PHP_AUTH_USER', | |
'PHP_AUTH_PW', | |
'AUTH_TYPE', | |
'PATH_INFO', | |
'ORIG_PATH_INFO') ; | |
echo '<table cellpadding="10">' ; | |
foreach ($indicesServer as $arg) { | |
if (isset($_SERVER[$arg])) { | |
echo '<tr><td>'.$arg.'</td><td>' . $_SERVER[$arg] . '</td></tr>' ; | |
} | |
else { | |
echo '<tr><td>'.$arg.'</td><td>-</td></tr>' ; | |
} | |
} | |
echo '</table>' ; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment