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

后端 未结 13 1157
我寻月下人不归
我寻月下人不归 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:26

    http://myexternalip.com provides this kind of information. To retrieve your IP you have plenty of options:

    • http://myexternalip.com/ - browser + lot's of examples of how to use it
    • http://myexternalip.com/raw - a pure text answer, only your ip, no other crap
    • http://myexternalip.com/json - a resposnse ready for json-parsers, also supports jsonp
    • HEAD http://myexternalip.com - send only a HEAD-request and get the answer

提交回复
热议问题