Jeffrey Neo Jeffrey Neo - 8 days ago 5
HTML Question

Get the IP address (192.168.X.X, assigned by the wireless router) in my webpage?

How do I get the inner IP address in my webpage? Can be any language for designing a website (javascript,php,etc.). What I need to do actually, is to make a local web server, and to let the clients in the same wifi network to connect via its shown IP address(192.168.X.X) on a webpage. But I always get 127.0.0.1 in php instead of 192.168.X.X, any ideas?

Answer

I solved by the following code, getting the wireless local IP address(192.168.X.X):

$myIP = gethostbyname(trim(`hostname`));