How do I find out what my external IP address is?

后端 未结 13 1176
我寻月下人不归
我寻月下人不归 2020-12-13 04:15

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,

13条回答
  •  渐次进展
    2020-12-13 04:43

    Unfortunately there is no easy way to do it.

    I would use a site like www.whatsmyip.org and parse the output.

    checkip.dyndns.com returns a very simple HTML file which looks like this:

    
      
        Current IP Check
      
      
        Current IP Address: 84.151.156.163
      
    
    

    This should be very easy to parse. Moreover the site is exists for about ten years. There is hope that it will be around for a while.

提交回复
热议问题