How to get the public IP address of the device

前端 未结 9 606
陌清茗
陌清茗 2020-12-29 10:32

I found this sample code to get all local IP addresses, but I don\'t find an easy solution to get the public IP.

A legacy class from Apple allowed to do that ... bu

9条回答
  •  不知归路
    2020-12-29 10:54

    You can call a public IP address lookup services to get this? I have set up http://ipof.in as a service that returns the device IP address as JSON / XML or plain text. You can find them here

    For JSON with GeoIP data

    http://ipof.in/json

    https://ipof.in/json

    For XML response

    http://ipof.in/xml

    https://ipof.in/xml

    For plain text IP address

    http://ipof.in/txt

    https://ipof.in/txt

提交回复
热议问题