i need to get local IP of computer like 192.*.... with PHP, is this possible?
i need IP address of system running the script, but i dont need his internet IP, i need his local network card IP.
Thanks
i need to get local IP of computer like 192.*.... with PHP, is this possible?
i need IP address of system running the script, but i dont need his internet IP, i need his local network card IP.
Thanks
Depends what you mean by local:
If by local you mean the address of the server/system executing the PHP code, then there are still two avenues to discuss. If PHP is being run through a web server, then you can get the server address by reading $_SERVER['SERVER_ADDR']; If PHP is being run through a command line interface, then you would likely have to shell-execute 'ipconfig/ifconfig' and grep out the address.
If by local you mean the remote address of the website visitor, but not their external IP address (since you specifically said 192.*), then you are out of luck. The whole point of NAT routing is to hide that address. You cannot identify the local addresses of individual computers behind an IP address, but there are some tricks (user agent, possibly mac address) that can help differentiate if there are multiple computers accessing from the same IP.
Try $_SERVER["X-FORWARDED-FOR"] or $_SERVER["REMOTE_ADDR"]. You can see all avaliable variables at phpinfo() output.