I'd like to make a program for my Ubuntu that checks the external ip of the computer. My idea is to go to whatsmyip.org and print out what is written in the
You should use DNS for this rather than HTTP for reliability's sake.
Opendns provides a meta-address,
myip.opendns.com, that will be resolved to your global IP when resolved by their resolver(s).
In a nutshell, you can do:
dig myip.opendns.com @resolver1.opendns.com
Just the IP:
dig +short myip.opendns.com @resolver1.opendns.com