Request Inspector
This page shows all the information PHP receives about your request via $_SERVER.
Most Useful Values
| Key | Value | Description |
|---|---|---|
| REQUEST_METHOD | GET | HTTP method used |
| REQUEST_URI | /php-tutorial/03-headers/request-inspector.php | Full request path |
| QUERY_STRING | Query string portion | |
| HTTP_HOST | cse135.site | Requested hostname |
| REMOTE_ADDR | 216.73.216.97 | Client IP address |
| HTTP_USER_AGENT | Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; ClaudeBot/1.0; +claudebot@anthropic.com) | Browser identification |
| HTTP_ACCEPT | */* | Accepted content types |
| HTTP_ACCEPT_LANGUAGE | Preferred languages | |
| HTTP_COOKIE | (none) | Cookies sent |
| CONTENT_TYPE | (none) | Request body type |
| CONTENT_LENGTH | (none) | Request body size |
Notice the pattern: HTTP headers become HTTP_* keys.
The header User-Agent becomes $_SERVER['HTTP_USER_AGENT']
Hyphens become underscores, everything is uppercased.
Server Information
| Key | Value |
|---|---|
| SERVER_SOFTWARE | Apache/2.4.58 (Ubuntu) |
| SERVER_NAME | cse135.site |
| SERVER_PORT | 443 |
| DOCUMENT_ROOT | /var/www/cse135.site/public_html |
| SCRIPT_FILENAME | /var/www/cse135.site/public_html/php-tutorial/03-headers/request-inspector.php |
| PHP_SELF | /php-tutorial/03-headers/request-inspector.php |
All $_SERVER Variables
Click to expand (29 variables)
| Key | Value |
|---|---|
| HTTPS | on |
| SSL_TLS_SNI | cse135.site |
| HTTP_ACCEPT | */* |
| HTTP_USER_AGENT | Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; ClaudeBot/1.0; +claudebot@anthropic.com) |
| HTTP_ACCEPT_ENCODING | gzip, br, zstd, deflate |
| HTTP_HOST | cse135.site |
| PATH | /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/snap/bin |
| SERVER_SIGNATURE | <address>Apache/2.4.58 (Ubuntu) Server at cse135.site Port 443</address> |
| SERVER_SOFTWARE | Apache/2.4.58 (Ubuntu) |
| SERVER_NAME | cse135.site |
| SERVER_ADDR | 146.190.172.158 |
| SERVER_PORT | 443 |
| REMOTE_ADDR | 216.73.216.97 |
| DOCUMENT_ROOT | /var/www/cse135.site/public_html |
| REQUEST_SCHEME | https |
| CONTEXT_PREFIX | |
| CONTEXT_DOCUMENT_ROOT | /var/www/cse135.site/public_html |
| SERVER_ADMIN | webmaster@localhost |
| SCRIPT_FILENAME | /var/www/cse135.site/public_html/php-tutorial/03-headers/request-inspector.php |
| REMOTE_PORT | 55117 |
| GATEWAY_INTERFACE | CGI/1.1 |
| SERVER_PROTOCOL | HTTP/1.1 |
| REQUEST_METHOD | GET |
| QUERY_STRING | |
| REQUEST_URI | /php-tutorial/03-headers/request-inspector.php |
| SCRIPT_NAME | /php-tutorial/03-headers/request-inspector.php |
| PHP_SELF | /php-tutorial/03-headers/request-inspector.php |
| REQUEST_TIME_FLOAT | 1770173801.1415 |
| REQUEST_TIME | 1770173801 |
Accessing in PHP
<?php // Get specific values $method = $_SERVER['REQUEST_METHOD']; $userAgent = $_SERVER['HTTP_USER_AGENT'] ?? 'Unknown'; $clientIP = $_SERVER['REMOTE_ADDR']; // Check for specific header $acceptsJson = strpos($_SERVER['HTTP_ACCEPT'] ?? '', 'application/json') !== false; // Check if HTTPS $isSecure = isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off'; ?>