概述

在很多时候需要查询当前服务器所处的公网IP地址信息,由于无法使用浏览器访问,只能通过接口方式来进行获取。

接口列表

在命令行界面使用curl直接请求即可。

太平洋电脑网
https://whois.pconline.com.cn/ipJson.jsp?json=true
{"ip":"223.70.0.2","pro":"北京市","proCode":"110000","city":"北京市","cityCode":"110000","region":"","regionCode":"0","addr":"北京市 移动","regionNames":"","err":""}
爱奇艺
https://ip.if.iqiyi.com/api/v1/query?format=json
{"code":0,"data":{"cidr":"223.72.24.0/21","ip":"223.72.22.22","isp_id":147,"continent_id":1,"country_id":48,"zone_id":1,"province_id":1,"city_id":1000,"county_id":0,"town_id":0,"isp_cn":"移动","continent_cn":"亚洲","country_cn":"中国","zone_cn":"华北","province_cn":"北京","city_cn":"北京","county_cn":"*","town_cn":"*","isp_en":"CMNET","continent_en":"Asia","country_en":"CN","zone_en":"HB","province_en":"BeiJing","city_en":"BeiJing","county_en":"*","town_en":"*","latitude":"39.929986","longitude":"116.395645"}}
腾讯地图
https://apis.map.qq.com/ws/location/v1/ip?key=TKUBZ-D24AF-GJ4JY-JDVM2-IBYKK-KEBCU&output=json
{"status":0,"message":"Success","request_id":"0cb653ac-2230-4734-89ef-f14914ccfb2f","result":{"ip":"223.72.22.22","location":{"lat":39.90469,"lng":116.40717},"ad_info":{"nation":"中国","province":"北京市","city":"北京市","district":"","adcode":110000}}}
搜狐
https://pv.sohu.com/cityjson
var returnCitySN = {"cip": "223.72.22.22", "cid": "CN", "cname": "CHINA"};
Hsselite
https://www.hsselite.com/ipinfo
{"asn":14061,"aso":"DIGITALOCEAN-ASN","city":"Santa Clara","continent_code":"NA","country_code":"US","country_name":"United States","dma_code":807,"ip":"165.232.134.28","is_hotspotshield_connected":false,"isp":"Digital Ocean","latitude":37.3931,"longitude":-121.962,"organization":"Digital Ocean","postal_code":"95054","region":"CA"}
IPIP
https://v6r.ipip.net/
223.72.23.2
淘宝
https://www.taobao.com/help/getip.php
ipCallback({ip:"223.72.23.2"})
42
http://ip.42.pl/raw
165.232.134.24
jsonip
http://jsonip.com
{"ip":"165.232.154.24","geo-ip":"https://getjsonip.com/#plus","API Help":"https://getjsonip.com/#docs"}
httpbin
http://httpbin.org/ip
{
  "origin": "165.232.134.28"
}
ipify
https://api.ipify.org/
165.232.132.28
END

本文标题:通过接口查询本地服务器外网IP地址

本文作者:宇宙最帅的男人

本文链接:https://www.ym68.cc/Others/202115106.html

版权声明:转载或者引用本文内容请注明来源及原作者,本文著作权归作者 (宇宙最帅的男人) 所有。

除非另有说明,本作品采用知识共享署名-非商业性使用-相同方式共享 4.0 国际许可协议

最后修改:2022 年 03 月 26 日
如果觉得我的文章对你有用,请随意赞赏