Get all the information of client's machine with this small PHP:
Mã:
<?php
foreach($_SERVER as $key => $value) {
echo '$_SERVER["' . $key . '"] = ' . $value . "<br>";
}
?>
Output:
$_SERVER["USER"] = nginx
$_SERVER["HOME"] = /var/lib/nginx
$_SERVER["FCGI_ROLE"] = RESPONDER
$_SERVER["SCRIPT_FILENAME"] = /var/www/html/public_html/file-test-123456789.php
$_SERVER["QUERY_STRING"] =
$_SERVER["REQUEST_METHOD"] = GET
$_SERVER["CONTENT_TYPE"] =
$_SERVER["CONTENT_LENGTH"] =
$_SERVER["SCRIPT_NAME"] = /file-test-123456789.php
$_SERVER["REQUEST_URI"] = /file-test-123456789.php
$_SERVER["DOCUMENT_URI"] = /file-test-123456789.php
$_SERVER["DOCUMENT_ROOT"] = /var/www/html/public_html
$_SERVER["SERVER_PROTOCOL"] = HTTP/1.1
$_SERVER["REQUEST_SCHEME"] = http
$_SERVER["GATEWAY_INTERFACE"] = CGI/1.1
$_SERVER["SERVER_SOFTWARE"] = nginx/1.18.0
$_SERVER["REMOTE_ADDR"] = 172.68.22.9
$_SERVER["REMOTE_PORT"] = 29916
$_SERVER["SERVER_ADDR"] = 51.79.25.3
$_SERVER["SERVER_PORT"] = 80
$_SERVER["SERVER_NAME"] = www.chiase123.com
$_SERVER["REDIRECT_STATUS"] = 200
$_SERVER["HTTP_HOST"] = chiase123.com
$_SERVER["HTTP_CONNECTION"] = Keep-Alive
$_SERVER["HTTP_ACCEPT_ENCODING"] = gzip, br
$_SERVER["HTTP_X_FORWARDED_FOR"] = 116.99.251.86
$_SERVER["HTTP_CF_RAY"] = 86464a336c1b85d5-HKG
$_SERVER["HTTP_X_FORWARDED_PROTO"] = https
$_SERVER["HTTP_CF_VISITOR"] = {"scheme":"https"}
$_SERVER["HTTP_CACHE_CONTROL"] = max-age=0
$_SERVER["HTTP_SEC_CH_UA"] = "Google Chrome";v="123", "Not:A-Brand";v="8", "Chromium";v="123"
$_SERVER["HTTP_SEC_CH_UA_MOBILE"] = ?0
$_SERVER["HTTP_SEC_CH_UA_PLATFORM"] = "Windows"
$_SERVER["HTTP_UPGRADE_INSECURE_REQUESTS"] = 1
$_SERVER["HTTP_USER_AGENT"] = Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/123.0.0.0 Safari/537.36
$_SERVER["HTTP_ACCEPT"] = text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7
$_SERVER["HTTP_SEC_FETCH_SITE"] = none
$_SERVER["HTTP_SEC_FETCH_MODE"] = navigate
$_SERVER["HTTP_SEC_FETCH_USER"] = ?1
$_SERVER["HTTP_SEC_FETCH_DEST"] = document
$_SERVER["HTTP_ACCEPT_LANGUAGE"] = vi-VN,vi;q=0.9,fr-FR;q=0.8,fr;q=0.7,en-US;q=0.6,en;q=0.5
$_SERVER["HTTP_COOKIE"] = **********************
$_SERVER["HTTP_PRIORITY"] = u=0, i
$_SERVER["HTTP_CF_CONNECTING_IP"] = 116.99.251.86
$_SERVER["HTTP_CDN_LOOP"] = cloudflare
$_SERVER["HTTP_CF_IPCOUNTRY"] = VN
$_SERVER["PHP_SELF"] = /file-test-123456789.php
$_SERVER["REQUEST_TIME_FLOAT"] = 1710440553.5395
$_SERVER["REQUEST_TIME"] = 1710440553
IP Address (IPv4):
Mã:
echo $_SERVER["HTTP_X_FORWARDED_FOR"];
Output:
116.99.251.86
Operating System:
Mã:
echo $_SERVER["HTTP_SEC_CH_UA_PLATFORM"];
Output:
Windows
Browser:
Mã:
echo $_SERVER["HTTP_USER_AGENT"];
Output:
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/123.0.0.0 Safari/537.36
Location:
Mã:
echo $_SERVER["HTTP_CF_IPCOUNTRY"];
Output:
VN