快速获取游客和用户IP的具体实现方法
来源:互联网 发布:淘宝店铺入驻有什么好 编辑:程序博客网 时间:2024/03/28 16:45
废话不多说,贴代码!
<pre name="code" class="html"><!DOCTYPE html><html><head><title>Get my IP</title></head><body><a href="http://www.whatsmyip.us">whatsmyip</a> My Real IP is: <script type="text/javascript" src="http://www.whatsmyip.us/showipsimple.php"></script><script type="text/javascript">document.write("<br/>");</script><a href="http://pv.sohu.com/cityjson?ie=utf-8">Sohu API</a> My IP Info: <script type="text/javascript" src="http://pv.sohu.com/cityjson?ie=utf-8"></script><script type="text/javascript">var cip = returnCitySN.cip;var cid = returnCitySN.cid;var cname = returnCitySN.cname;document.write("IP is:" + cip + " " + "Address is:" + cname);</script><script type="text/javascript">document.write("<br/>");</script><a href="http://whois.pconline.com.cn/ipJson.jsp?callback=myip">PConline[太平洋] API</a><script type="text/javascript">/** * [myip description] 这儿用到了回调函数,myip({"ip":"27.17.140.49","pro":"湖北省","proCode":"420000","city":"武汉市","cityCode":"420100","region":"","regionCode":"0","addr":"湖北省武汉市 电信","regionNames":""});,我们可以看到,回调函数myip()里面有参数,仔细观察不难发现是json型数据,我们在回调函数里面用obj去获取它,这个参数随便定都可以,然后哦这个参数就是我们获取的这个json型数据了. * @param {[type]} obj [description] 与返回的json型数据一一对应 * @return {[type]} [description] */function myip(obj){document.write("IP is:" + obj.ip + " " + "Address is:" + obj.addr);}</script><script type="text/javascript" src="http://whois.pconline.com.cn/ipJson.jsp?callback=myip"></script></body></html>
相比大家应该一目了然,自己可以把代码copy下去自己是一下就知道了。
2 0
- 快速获取游客和用户IP的具体实现方法
- 获取用户IP的方法
- 获取用户IP的方法
- phpwind和discuz中获取用户IP的方法
- java获取登陆用户ip和mac地址的方法
- 热插拔uevent事件用户空间截获方法和具体实现
- 多线程的同步方法和具体实现
- 获取用户的IP
- 获取用户真实ip方法
- 快速查找和你聊天人的IP和具体的物理所在地址
- 统计在线注册用户和游客人数
- Yii2 游客、用户防范规则和限制
- js前端获取 用户的ip地址的方法
- python django 获取用户IP地址的方法
- web站点获取用户IP的安全方法 HTTP_X_FORWARDED_FOR检验
- PHP获取用户访问IP地址的5种方法
- web站点获取用户IP的安全方法 HTTP_X_FORWARDED_FOR检验
- 使用nginx服务器时,php获取用户ip的方法
- java.lang.ClassCastException: android.widget.TextView cannot be cast to android.widget.EditText
- 第11周 程序阅读——继承和派生 自选阅读(3)
- poj 1719(二分图匹配)
- 5、理解面向对象程序设计——封装
- 黑马程序员——Java基础知识之DUI(图形用户界面)
- 快速获取游客和用户IP的具体实现方法
- POJ3045 Cow Acrobats (贪心)
- 6、面向对象之封装
- K-L变换和PCA的区别
- windows程序设计——窗口类
- leetcode_Rotate Image
- C++ 自动更新
- 黑马程序员——高新技术——反射
- 基于Win32的VTK多窗口程序创建