someoneb100 someoneb100 - 3 months ago 6x
Python Question

Making a program that checks external ip

I'd like to make a program for my Ubuntu that checks the external ip of the computer. My idea is to go to and print out what is written in the

with the
in the Terminal. Writing the entire code is not necessary because i am doing this as an exercise (if you want to i won't stop you), but i don't know where to start so i'd appreciate some guidelines.

PHP, C, Python and Bash are my weapons of choice, so any advice involving these is welcome.

EDIT: I haven't explained well what i want. I want to learn how to fetch data from webites in programs. Checking the ip was just an idea how to try and learn it.


You should use DNS for this rather than HTTP for reliability's sake.

Opendns provides a meta-address,, that will be resolved to your global IP when resolved by their resolver(s).

In a nutshell, you can do:


Just the IP:

dig +short