But where are you currently running your test script? On an external webserver, or locally on your LAN? Your results look as if you are running it locally on your LAN. Only if you run your script on an external webserver will it return your external IP address. Google and all the other sites that show you your IP address are external and therefore show you your external IP address.