My computers are sitting behind a router/firewall. How do I programmatically find out what my external IP address is. I can use http://www.whatsmyip.org/ for ad-hoc queries, but the TOS don't allow for automated checks.
Any ideas?
My computers are sitting behind a router/firewall. How do I programmatically find out what my external IP address is. I can use http://www.whatsmyip.org/ for ad-hoc queries, but the TOS don't allow for automated checks.
Any ideas?
or
Incase you don't have curl installed,
Hope this helps.
If the router you are behind speak UPnP you could always use a UPnP library for whatever language you are developing in to query the router for its external ip.
ifcfg.me allows Lookup via
nslookup
telnet
ftp
and http
even works with IPv6
Simple but not elegant for this use. I installed some security cameras and my cable provider - Wide Open West or WOWWAY wanted $10 a month to set up a static IP - EXTORTION for a DHCP reservation ... so, I created a VBS file with the following code to drop the result to dropbox and google drive ... have to delete the file for new one to sync though for some reason.
This runs on a PC at my home. My PC is set to resume on power outage and a task is scheduled to run this every day once (note if you have it run often, the site will block your requests).
Now I can get my IP address on the road and watch people steal my stuff :-)
http://ipecho.net/plain appears to be a workable alternative, as whatismyip.com now requires membership for their automated link. They very kindly appear to be offering this service for free, so please don't abuse it.
If you have access to a webserver with modphp, you can roll your own:
If you don't want that to get abused, you'll have to keep it secret or add request limits.
I've been using one on my server for years.
Explicitly:
Create a file called whatismyip.php in your public_html folder in your website. It can be called anything and be anywhere in your webroot.
Add the line above, and then query your server:
for example.