IP地址查询接口及调用方法

为什么80%的码农都做不了架构师?>>>   hot3.png

  • 设计蜂巢IP地址查询接口:http://www.hujuntao.com/api/ip/ip.php
  • 腾讯IP地址查询接口:http://fw.qq.com/ipaddress
  • 新浪IP地址查询接口:http://int.dpool.sina.com.cn/iplookup/iplookup.php?format=js
  • 搜狐IP地址查询接口:http://pv.sohu.com/cityjson
  • 谷歌IP地址查询接口:http://j.maxmind.com/app/geoip.js
  • 有道IP地址查询接口:http://www.youdao.com/smartresult-xml/search.s
  • 1616 IP地址查询接口:http://w.1616.net/chaxun/iptolocal.php
  • 126 http://ip.ws.126.net/ipquery
  • hao123 http://app.hao123.com/ipquery/getcity.php?rtype=2

设计蜂巢接口调用方法

API请求地址 : http://www.hujuntao.com/api/ip/ip.php?参数

参数说明:

  • IP : IP地址 可选
  • format : 输出格式 json 可选 默认为JS

JSON调用示例:
请求地址:http://www.hujuntao.com/api/ip/ip.php?callback=jQuery17107324279078748077_1327024991339&format=json&_=1327024991363

{
"ip": "117.89.35.58",
"province": "\u6c5f\u82cf",
"city": "\u5357\u4eac"
}

腾讯接口调用方法

<script src="http://fw.qq.com/ipaddress"></script>
<script type="text/javascript">
//反回格式如下:
//var IPData = new Array("117.89.35.98","","江苏省","南京市");
console.log(IPData[0]+','+IPData[2]+','+IPData[3]) //117.89.35.98,江苏省,南京市
</script>

该方法已经不可用,访问http://fw.qq.com/ipaddre显示“The page you are looking for is temporarily unavailable.
Please try again later.”。腾讯对Referer做了判断,虽然可以通过PHP伪造Referer,但是实际测试中获得的是服务器的IP地址而不是客户端的IP地址。我们一起鄙视一下腾讯。╭∩╮(︶︿︶)╭∩╮

新浪接口调用方法

<script src="http://int.dpool.sina.com.cn/iplookup/iplookup.php?format=js"></script>
<script type="text/javascript">
//format参数设置返回格式 js/json
//ip 要查询IP 可选
//反回格式如下:
//var remote_ip_info = {"ret":1,"start":"117.89.35.0","end":"117.89.35.255","country":"\u4e2d\u56fd","province":"\u6c5f\u82cf","city":"\u5357\u4eac","district":"\u767d\u4e0b","isp":"\u7535\u4fe1","type":"","desc":""};
console.log(remote_ip_info["country"]+','+remote_ip_info["province"]+"省"+','+remote_ip_info["city"]+"市")//中国,江苏省,南京市
</script>

搜狐接口调用方法

<script src="http://pv.sohu.com/cityjson?ie=utf-8"></script>
<script type="text/javascript">
//默认为GBK可通过ie参数设置编码
console.log(returnCitySN["cip"]+','+returnCitySN["cname"])//117.89.35.98,江苏省南京市
</script>

谷歌接口调用方法

据说是谷歌的,不知道是不是真的。

<script src="http://j.maxmind.com/app/geoip.js"></script>
<script type="text/javascript">
console.log(geoip_country_name()+','+geoip_region_name()+','+geoip_city())//China,Jiangsu,Nanjing
</script>

有道接口调用方法

调用接口示例:http://www.youdao.com/smartresult-xml/search.s?type=ip&q=123.233.157.9

返回XML数据

<?xml version="1.0" encoding="gbk"?>
<smartresult>
<product type="ip">
<ip>123.233.157.9</ip>
<location>山东省济南市 网通</location>
</product>
</smartresult>

或者

http://www.youdao.com/smartresult-xml/search.s?jsFlag=true&keyfrom=163.com&event=fYodaoCallBack&type=ip&q=192.168.1.1

返回JSON数据

fYodaoCallBack(1, {‘product’:'ip’,'ip’:’192.168.1.1′,’location’:'局域网 对方和您在同一内部网’} , ”);

转载于:https://my.oschina.net/quttap/blog/80437

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/news/548306.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

c++11或c++14或c++17参数包的使用

include //张开函数啦 template void display1(T a) { std::cout << a << std::endl; } template void display1() { std::cout << “void” << std::endl; } //逗号展开函数 template<typename Tvoid,typename … Args> void display1(T fi…

加解密技术(Cryptography)基本概念

转载自&#xff1a;http://www.cnblogs.com/piyeyong/archive/2010/06/10/1744692.html 要想实现在不安全的网络上的安全通信&#xff0c;需要考虑3个方面的问题&#xff1a;保密(Privacy)&#xff0c;认证(Authentication)&#xff0c;完整性(Integrity)。 1.保密(Privacy) 数…

select的列子说明select内部实现原理

1:select内部是个数组&#xff0c;而epoll内部结构是红黑二叉树 2&#xff1a;select查询起来慢&#xff0c;而epoll查询起来快 3:每次循环&#xff0c;内部都要发生拷贝&#xff08;查看相关代码&#xff09;而epoll不需要这样的操作,也就是初始化一次拷贝 #include #include&…

.NET配置文件读写实例(附SosoftConfigHelper类)

配置文件在软件开发中起到举足轻重的作用&#xff0c;可以说不可或缺。.NET程序可使用.config文件作为配置文件&#xff0c;例如WinForm程序的*.app.config、Web程序的web.config。.config文件是标准的XML文件。本实例可读取、修改和添加app.confing或者web.config文件的appSet…

关于shared_from_this的转换

声明&#xff1a;以下这函数&#xff0c;使用场景再lambda表达式中使用 std::weak_ptr<websockets_session> weak_self() { return std::weak_ptr<websockets_session>(shared_from_this()); }

HTML5标签

<header>主要用于导航&#xff0c;头部&#xff0c;可以嵌套&#xff0c;但不可以嵌套在<address>标签中。 <hgroup>在<header>里面定义具体内容的&#xff0c;是一个小容器。 <article></article>:大块文章&#xff0c;主要用于文字的显示…

多态的调用方法

1: 父类的指针指向子类的地址&#xff0c;然后调用虚函数 列子: #include<iostream> #include<memory> class A { public: A() default; virtual ~A() default; virtual void display() { std::cout << "A" <<…

spring security3 统计在线用户

首先&#xff0c;我们需要使得ConcurrentSessionFilter生效并在spring-security.xml配置。[html] view plaincopy<http auto-config"true" use-expressions"true"> <!-- Uncomment to limit the number of sessions a user can have --> …

node.js编程错误记录集

这是有关于我最近学习node.js中出现的错误的记录和纠正过程&#xff0c;因为我只是一名初学者&#xff0c;所以&#xff0c;遇到的错误可能真的是非常简单&#xff0c;如拼写错误等等&#xff0c;这些我当然是不会记录下来的&#xff0c;但是如果是一些我一时看不懂&#xff0c…

wstring和string简单正则表达式使用

std::regex e("([ ])3DSMAX(\d{4})_MAIN([^ ])"); //std::regex e("([^ ])3DSMAX(\d{4})_MAIN"); std::smatch sub_match; //从第一行中解析请求方法、路径和 HTTP 版本 std::string line “VRAY30_RT_FOR_3DSMAX2016_MAIN”; if (std::regex_match(line,…

【引用】phpmyadmin提示Access denied for user 'root'@'localhost' (using password: NO)的解决办法...

一、错误内容 今天用phpmyadmin连接mysql里面的某个数据库时时遇到了下面的提示&#xff1a; #1045 - Access denied for user rootlocalhost (using password: NO) phpMyAdmin 试图连接到 MySQL 服务器&#xff0c;但服务器拒绝连接。您应该检查 config.inc.php 中的主机、用户…

Nuget 启用数据库迁移的时候一定要把包含DbContext的项目设为启动项目

在为项目启用数据库迁移的时候&#xff08;enable-migrations&#xff09;出现如下错误&#xff1a; 在程序集“XX”中未找到迁移配置类型“XX.Migrations.Configuration” 之前一直正确的&#xff0c;并没有修改项目中的代码&#xff0c;花了小半天找原因&#xff0c;stackove…

string、wstring、UTF-8、UTF-16、UTF-32之间转换

//string转wstring std::wstring string_to_wstring(const std::string& str) { setlocale(LC_ALL, “”); std::int64_t size mbstowcs(NULL, str.c_str(), 0); std::wstring w_str; w_str.resize(size); //算出代转wstring字节 mbstowcs(w_str.data(), str.c_str(), str…

论贱人

来源于我在论坛的一帖&#xff0c;个中缘由不说也罢。<<论贱人>> 天地阴阳&#xff0c;构精而生万物&#xff0c;万物生而后人生。物有性格&#xff0c;人亦有性格。性有善恶之分&#xff0c;格有贵贱之别。古人尝论人性之善恶&#xff0c;孟子云人性本善&#xff…

Delphi用ini文档实现界面无闪烁多语言转换

越来越多的程序使用了多国语言切换&#xff0c;虽然DELPHI自带多语言包的添加和配置&#xff0c; 但是那种方法在切换语言时界面会出现闪烁&#xff0c;而且实现起来很麻烦&#xff0c;这里我介绍给大家的是利用INI文件来读取界面的语种文字&#xff0c; 用这种方法&#x…

vi交互式批量替换 vi批量替换 vi查找和替换

vi中如何实现批量替换&#xff1f; 举个例子啊&#xff1a; 将文件tihuan&#xff08;假设此文本中字符a&#xff09;中的所有字符a换成字符w&#xff0c;其命令为&#xff1a; 1。vi tihuan 2。按esc键 3。按shift&#xff1a; 4。在&#xff1a;后输入 %s/a/w/g 其中s为&a…

linux的开始

这个星期天我去同学聚会了&#xff0c;开封的来了个同学李永生&#xff0c;新乡的来了个同学陈凯&#xff0c;大家在周六下午在一块吃了个饭&#xff0c;虽说有些小插曲&#xff0c;&#xff08;保成的女朋友和桂林&#xff08;桂皮&#xff09;来晚了&#xff09;&#xff0c;…

内联命名空间(inline namespace)

#include<iostream> //直接使用,不需要using inline namespace B { class A { public: A() default; ~A() default; void display() { std::cout << "a" << std::endl; } }; } i…

WordPress主题制作常用代码集合

如何你是个wordpress主题设计者&#xff0c;可能会在制作wordpress主题时为了一些寻找合适的wordpress代码焦虑&#xff0c;这里搜集总结wordpress主题开发中常用的代码片段&#xff0c;希望为你工作中带来方便 最新文章最新更新文章/页面最新评论最受欢迎文章文章分类下拉框文…

电脑配置多个git账号

配置user1 Host u1.github.com HostName github.com IdentityFile C:\Users\admin\.ssh\id_rsa1 PreferredAuthentications publickey User user1 配置user2 Host u2.github.com HostName github.com IdentityFile C:\Users\admin\.ssh\id_rsa PreferredAuthentications pub…