I can easily use PHP to identify the IP of my locally running apache server - 127.0.0.1
Is it possible with PHP to find the IP of my machine - eg. 192.168.0.4 ?
127.0.0.1 isnt a 'real' IP per-se, it's the Localhost Feedback Loop.
By 'my machine' do you mean the server or the person connecting to that server?
The IP address designated by my router is currently 192.168.0.4. I'm running AMP through XAMPP on a Windows machine. Can PHP find the 192.168.04?
This is about running scripts just on my machine rather than on the web. Hope this explains things better.
Well there are two potential IP's to catch - the Server's IP (which should never change), and the Client's IP (which will be different for anyone who's visiting your site).
Both elements can be tracked in the $_SERVER predefined array;
Thanks for your help, but $_SERVER variables don't pull the information I require. Both of your suggestions produce 127.0.0.1
I suspect it's not possible for PHP to reach beyond the scope of the web server to get what I want.
$myIP = gethostbyname(trim(hostname
Excellent, exactly what I was looking for!
$SERVER['SERVERADDR'] reveals the IP the server was reached with for this session, not necessarily the IP assigned to the domain name. You can force the two to match as a security measure.