I have the PHP coe running on a server. I want the IP address of the local system. This question has been asked before - PHP how to get local IP of system
When I use any of the solutions mentioned in the above post, I can only get the hostname, not the IP address.
e.g. on my machine I have
eth0:10.0.2.15
eth1:192.168.1.115
When I run the following code:
$localIP = getHostByName(getHostName());
I only get the hostname - localvm
. I want 192.168.1.115
Can I get the private ip address? more specifically can I get the IP address at a specific port?