I need to get local IP of computer like 192.*.... Is this possible with PHP?
I need IP address of system running the script, but I do not need the external IP, I need his local network card address.
I need to get local IP of computer like 192.*.... Is this possible with PHP?
I need IP address of system running the script, but I do not need the external IP, I need his local network card address.
try this (if your server is Linux):
If you are in a dev environment on OS X, connected via Wifi:
PHP_SELF
Returns the filename of the current script with the path relative to the rootSERVER_PROTOCOL
Returns the name and revision of the page-requested protocolREQUEST_METHOD
Returns the request method used to access the pageDOCUMENT_ROOT
Returns the root directory under which the current script is executingThis is an old post, but get it with this:
For example:
Found it on another site, do not remove the trim command because otherwise you will get the computers name.
BACKTICKS (The special quotes): It works because PHP will attempt to run whatever it's between those "special quotes" (backticks) as a shell command and returns the resulting output.
Is very similar (but much more efficient) than doing:
hostname(1) can tell the IP address:
hostname --ip-address
, or as man says, it's better to usehostname --all-ip-addresses
I tried in Windows pc and Its worked and also think that Will work on Linux to.