欢迎来到尧图网

客户服务 关于我们

您的位置:首页 > 文旅 > 旅游 > 全球IP归属地查询-IP地址查询-IP城市查询-IP地址归属地-IP地址解析-IP位置查询-IP地址查询API接口-IP查询城市-IP解析城市

全球IP归属地查询-IP地址查询-IP城市查询-IP地址归属地-IP地址解析-IP位置查询-IP地址查询API接口-IP查询城市-IP解析城市

2024/10/24 20:12:26 来源:https://blog.csdn.net/hm_cth_lfq/article/details/142744583  浏览:    关键词:全球IP归属地查询-IP地址查询-IP城市查询-IP地址归属地-IP地址解析-IP位置查询-IP地址查询API接口-IP查询城市-IP解析城市

IP地址查询接口是指能够返回IP地址相关信息的网络接口,其返回的信息通常包括IP地址的归属地(如国家、省份、城市等)、运营商信息以及其他技术细节。以下是一些常见的IP地址查询接口及其特点:

一、国内IP地址查询接口

  1. 百度IP地址查询接口

    • 接口地址:[无限免费]全球IP归属地查询_API专区_云市场-阿里云(指定IP查询)
    • 请求方式:GET
    • 参数:对于当前IP查询,无需参数;对于指定IP查询,需传入IP地址等参数。
    • 返回结果:包括国家、省份、城市等信息。
  2. 具体信息

Java代码实现

//https://market.aliyun.com/apimarket/detail/cmapi00066996?spm=5176.730005.result.2.5ef9414ayVtSoP#sku=yuncode6099600002public static void main(String[] args) {String host = "https://kzipglobal.market.alicloudapi.com";String path = "/api/ip/query";String method = "POST";String appcode = "你自己的AppCode";Map<String, String> headers = new HashMap<String, String>();//最后在header中的格式(中间是英文空格)为Authorization:APPCODE 83359fd73fe94948385f570e3c139105headers.put("Authorization", "APPCODE " + appcode);//根据API的要求,定义相对应的Content-Typeheaders.put("Content-Type", "application/x-www-form-urlencoded; charset=UTF-8");Map<String, String> querys = new HashMap<String, String>();Map<String, String> bodys = new HashMap<String, String>();bodys.put("ip", "39.170.93.199");try {/*** 重要提示如下:* HttpUtils请从* https://github.com/aliyun/api-gateway-demo-sign-java/blob/master/src/main/java/com/aliyun/api/gateway/demo/util/HttpUtils.java* 下载** 相应的依赖请参照* https://github.com/aliyun/api-gateway-demo-sign-java/blob/master/pom.xml*/HttpResponse response = HttpUtils.doPost(host, path, method, headers, querys, bodys);System.out.println(response.toString());//获取response的body//System.out.println(EntityUtils.toString(response.getEntity()));} catch (Exception e) {e.printStackTrace();}}

ip解析城市结果

{"msg": "成功","success": true,"code": 200,"data": {"orderNo": "202408040848319168904","nation": "中国","province": "浙江省", //省份"city": "杭州市", //城市"ip": "39.170.93.199",  //本机ip"isp": "移动" //运营商}
}

版权声明:

本网仅为发布的内容提供存储空间,不对发表、转载的内容提供任何形式的保证。凡本网注明“来源:XXX网络”的作品,均转载自其它媒体,著作权归作者所有,商业转载请联系作者获得授权,非商业转载请注明出处。

我们尊重并感谢每一位作者,均已注明文章来源和作者。如因作品内容、版权或其它问题,请及时与我们联系,联系邮箱:809451989@qq.com,投稿邮箱:809451989@qq.com