PHP Project
This is a few tests of what PHP can do, using various commands.
IP-address
$_SERVER['REMOTE_ADDR']
Gives you the remote (requesting) IP-address:
38.107.179.207
$_SERVER['REMOTE_PORT']
The port being used on the user's machine to communicate with the web server:
39926
$_SERVER['SERVER_ADDR']
The IP address of the server under which the current script is executing:
193.202.110.201
$_SERVER['SERVER_PORT']
The port on the server machine being used by the web server for communication. For default setups, this will be '80'; using SSL, for instance, will change this to whatever your defined secure HTTP port is:
80
Software
$_SERVER['SERVER_SOFTWARE']
Server identification string, given in the headers when responding to requests:
Apache
Hyper Text Transfer Protocol (HTTP)
$_SERVER['HTTP_ACCEPT']
Contents of the Accept: header from the current request, if there is one:
text/html,application/xhtml+xml,text/xml;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5
$_SERVER['HTTP_ACCEPT_CHARSET']
Contents of the Accept-Charset: header from the current request, if there is one:
ISO-8859-1,utf-8;q=0.7,*;q=0.7
$_SERVER['HTTP_ACCEPT_LANGUAGE']
Contents of the Accept-Language: header from the current request, if there is one:
en-us,en;q=0.5
$_SERVER['HTTP_CONNECTION']
Contents of the Connection: header from the current request, if there is one:
close
HTTP paths and names
$_SERVER['HTTP_HOST']
Contents of the Host: header from the current request, if there is one:
skogberg.eu
$_SERVER['HTTP_USER_AGENT']
Contents of the User-Agent: header from the current request, if there is one. This is a string denoting the user agent being which is accessing the page:
CCBot/1.0 (+http://www.commoncrawl.org/bot.html)
Script and server
$_SERVER['SCRIPT_FILENAME']
The absolute pathname of the currently executing script:
/customers/0/9/e/skogberg.eu/httpd.www/ia/phpref.php
Country
You're surfing from this country:
UNITED STATES (US)
Using this code:
$IP = $_SERVER['REMOTE_ADDR']; // If IP address exists // Get country (and City) via api.hostip.info if (!empty($IP) ) { $country=file_get_contents('http://api.hostip.info/get_html.php?ip='.$IP); // Reformat the data returned (Keep only country and country abbr.) list($_country) = explode("\n", $country); $_country = str_replace("Country: ", "", $_country); echo($_country); }