当前位置:网站首页>【最新】【获取ip】获取本地ip 获取本机ip地址
【最新】【获取ip】获取本地ip 获取本机ip地址
2022-08-09 14:26:00 【刘贵庆】
目录:
一、接口介绍:
二、实现方法一
三、实现方法二
一、接口介绍:
大多地址都失效了,现推荐以下地址及使用方法:
获取本地ip地址支持的接口:
https://www.taobao.com/help/getip.php (强烈推荐)
https://whois.pconline.com.cn/ipJson.jsp (强烈推荐)
搜狐IP地址查询接口(可设置编码):
http://pv.sohu.com/cityjson?ie=utf-8 (不推荐,定位的市准区不准)
其他:
https://www.ip138.com (不推荐) (接口需要米)
https://www.ip.cn/api/index?ip=&type=0 (不推荐) (加载慢,且ie会保存为一个json文件)
二、实现方法一
<!--tb start-->
<script type="text/javascript">
function ipCallback(i) {
console.log(i.ip);
}
</script>
<!--要放于最底部-->
<script src="https://www.taobao.com/help/getip.php"></script>
<!--tb end-->
三、实现方法二
获取方法二:
<!--whois start-->
<script type="text/javascript">
function getip(obj) {
var ipinfo=obj.ip+","+obj.pro+","+obj.city+","+obj.region+",通讯:"+obj.addr;
console.log(ipinfo);
}
</script>
<!--要放于最底部-->
<script src="https://whois.pconline.com.cn/ipJson.jsp?callback=getip"></script>
<!--whois end-->边栏推荐
- Shell course summary
- 新起之秀 DPU,正在掀起数据中心变革!
- Regular expression combat: the latest Douban top250 crawler super detailed tutorial
- [Microservice] Detailed explanation of nacos registration center and configuration center
- 宁夏等保测评机构有哪些?如何选择?
- #25-1 OJ 78 Calculate birthday day of the week
- 【软考】2022年上半年软考过啦
- C语言程序设计笔记(浙大翁恺版) 第十周:字符串
- Use Baidu EasyDL to realize intelligent identification of health code/travel code in 30 minutes
- *3-1 CCF 2014-09-1 Adjacent pairs
猜你喜欢

Zero Time Technology | Nomad cross-chain bridge theft of 180 million US dollars incident analysis

刷完这174道Android开发面试题,搞懂所有技术栈

从TRPO到PPO(理论分析与数学证明)

R7 6800H标压处理器+RTX 3050独显 无畏Pro15锐龙版高能开卖

leetcode 剑指 Offer 07. 重建二叉树

论文笔记CIRS

*1-3 OJ 291 The mouse and cat trade

After reading the "Redis In-depth Notes" compiled by Tencent bosses in 90 days, I worshipped on the spot.

VSTO踩坑记录(2)- 运用outlook对象模型发送邮件

概率论基础知识整理 | 随机向量
随机推荐
*1-2 OJ 190 run-length code
SMI 与 Gateway API 的 GAMMA 倡议意味着什么?
*1-4 OJ 605 Gray Code
VMWare does not use easy install, install ISO manual manually
概率论基础知识整理 | 随机向量
C语言程序设计笔记(浙大翁恺版) 第十一周:结构类型
JVM如何判断对象无用
OpenFeign使用示例
实践数据湖iceberg 第三十八课 spark sql, Procedures语法进行数据治理(小文件合并,清理快照)
猴蝎美人
探索进军元宇宙的代表性企业
nav标签的作用
RHCE Course Summary
Assembly language learning (7)
兆骑科创创业大赛竞赛平台,双创服务,投融资对接
Architect's learning experience summary
After reading the "Redis In-depth Notes" compiled by Tencent bosses in 90 days, I worshipped on the spot.
拒绝“重复造轮子”,百度EasyDL让你玩转AI定制开发
R7 6800H标压处理器+RTX 3050独显 无畏Pro15锐龙版高能开卖
Regular expression combat: the latest Douban top250 crawler super detailed tutorial