On 3/26/12 5:23 AM, nescafe wrote:
> I need to develop one program which will:
> - find my external IP address
> - save this address into some string
> - write this address into one file.
>
>
> Any idea what should i use ( for first two options ) ?
>
> Regards!
Read:
http://www.whatismyip.com/faq/automation.asp
After reading this, the easiest thing to do is use the "curl" command
(for unix based OSes, including MacOS). You would curl the automation
URL (that is linked to from the above page) and redirect the output to
the file. Note, I'm not providing the direct link, because
whatismyip.com has specific TOS requirements.
The other perhaps more reliable but more difficult solution is to
"scrape" your routers admin pages. This works until you change routers,
or your router-firmware makes a change that isn't compatible with your
scraping. YMMV. whatismyip.com is fairly canonical.