I often hear people say to use \"$_SERVER[\'SERVER_ADDR\']\", but that returns the LAN IP of my server (e.g. 192.168.1.100). I want the external IP.
$_SERVER[\'SERVER_ADDR\']
Have you tried:
gethostbyname(php_uname('n'));
?