To get your external IP (as others see it) you can try to parse the output of http://www.whatismyip.org this output is plaintext, IPv4 only.