一个简单的公共IP获取服务
省去自己开发的判断的烦恼,可以轻易获取真实公网IP,专注业务场景开发
$ curl 'https://api.ipify.cn?format=json' {"ip":"0.0.0.0"}
API URL | 请求类型 | 返回示例 |
---|---|---|
http://api.ipify.cn | test | 98.207.254.136 |
http://api.ipify.cn?format=json | json | {"ip":"98.207.254.136"} |
http://api.ipify.cn?format=jsonp | jsonp | callback({"ip":"98.207.254.136"}); |
http://api.ipify.cn?format=jsonp&callback=getip | jsonp | getip({"ip":"98.207.254.136"}); |
API URL | 请求类型 | 返回示例 |
---|---|---|
https://api.ipify.cn | test | 98.207.254.136 |
https://api.ipify.cn?format=json | json | {"ip":"98.207.254.136"} |
https://api.ipify.cn?format=jsonp | jsonp | callback({"ip":"98.207.254.136"}); |
https://api.ipify.cn?format=jsonp&callback=getip | jsonp | getip({"ip":"98.207.254.136"}); |