当前位置:网站首页>Tencent resolves the address according to the IP address
Tencent resolves the address according to the IP address
2022-04-23 16:49:00 【A coir boat in the broken white clouds】
// Need to apply to Tencent key
private static String TXURL = "https://apis.map.qq.com/ws/location/v1/ip?key=&ip=";
public static String getTXCityCodeByIp(String ip) {
CloseableHttpClient httpClient = HttpClients.createDefault();
try {
String requestURL = String.format("%s%s", TXURL, ip);
HttpGet getMethod = new HttpGet(requestURL);
HttpResponse response = httpClient.execute(getMethod);
if (null != response && response.getStatusLine().getStatusCode() == 200) {
return EntityUtils.toString(response.getEntity(), "UTF-8");
}
} catch (Exception e) {
log.error("getTXCityCodeByIp ip:[{}] is Exception:{}", ip, e.toString());
} finally {
try {
httpClient.close();
} catch (IOException e) {
log.error(e.toString());
}
}
return null;
}
public static void main(String[] args) {
String ip = "";
System.out.println(getTXCityCodeByIp(ip));
}
版权声明
本文为[A coir boat in the broken white clouds]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/04/202204231400067875.html
边栏推荐
- Camtasia2022软件新增功能介绍
- 100 deep learning cases | day 41 - convolutional neural network (CNN): urbansound 8K audio classification (speech recognition)
- LVM与磁盘配额
- loggie 源码分析 source file 模块主干分析
- OMNeT学习之新建工程
- Deepinv20 installation MariaDB
- Mock test
- Set the color change of interlaced lines in cells in the sail software and the font becomes larger and red when the number is greater than 100
- Qipengyuan horizon credible meta universe social system meets diversified consumption and social needs
- Blue Bridge Cup provincial road 06 -- the second game of the 12th provincial competition
猜你喜欢
File upload and download of robot framework
磁盘管理与文件系统
Zhongang Mining: Fluorite Flotation Process
Set the color change of interlaced lines in cells in the sail software and the font becomes larger and red when the number is greater than 100
1959年高考数学真题
Installing labellmg tutorial in Windows
Ali developed three sides, and the interviewer's set of combined punches made me confused on the spot
Gartner publie une étude sur les nouvelles technologies: un aperçu du métacosme
loggie 源码分析 source file 模块主干分析
Phpstudy V8, a commonly used software for station construction 1 graphic installation tutorial (Windows version) super detailed
随机推荐
Gartner 發布新興技術研究:深入洞悉元宇宙
面试百分百问到的进程,你究竟了解多少
正则过滤内网地址和网段
On the security of key passing and digital signature
On the value, breaking and harvest of NFT project
Getting started with JDBC
Installing labellmg tutorial in Windows
MySQL master-slave replication
伪分布安装spark
Differences between MySQL BTREE index and hash index
04 Lua operator
文件操作详解(2)
Detailed explanation of file operation (2)
org. apache. parquet. schema. InvalidSchemaException: A group type can not be empty. Parquet does not su
Detailed explanation of information abstract, digital signature, digital certificate, symmetric encryption and asymmetric encryption
Pseudo Distributed installation spark
昆腾全双工数字无线收发芯片KT1605/KT1606/KT1607/KT1608适用对讲机方案
Dancenn: overview of byte self-developed 100 billion scale file metadata storage system
OMNeT学习之新建工程
【PIMF】OpenHarmony啃论文俱乐部—在ACM Survey闲逛是什么体验