目前我知道能用的有 baidu , taobao , sina .各自的查询地址在附件文件中有写,其中百度的要申请ak,其他的不要, taobao 的有 10qps 的查询限制,其他的没有.
速度方面, taobao>baidu>sina,其中 taobao 与 baidu 速度相当.(都没有本地纯真快).
我本地机器的查询速度:
CZ : 0.0210s
BAIDU : 0.2120s
SINA : 0.2860s
TAOBAO: 0.1670s
OIP : 0.1570s
其中 CZ 是纯真库本地解析, OIP 是用本贴里的库解析到的(下同),采用的是taobao的接口.各查询接口返回的内部也不尽相同,taobao的最详细,带各种ID(有点象身份证编码前面几位).baidu有带经纬度.
提供的类中,返回的只有他们的交集(省,市,县/区/地级市,ISP,IP)
以下是各个查询接口返回的详细信息.
BAIDU:
object(stdClass)#8 (3) {
["address"] => string(38) "CN|黑龙江|绥化|None|UNICOM|1|None"
["content"] => object(stdClass)#9 (3) {
["address"] => string(21) "黑龙江省绥化市"
["address_detail"] => object(stdClass)#10 (6) {
["city"] => string(9) "绥化市"
["city_code"] => int(44)
["district"] => string(0) ""
["province"] => string(12) "黑龙江省"
["street"] => string(0) ""
["street_number"] => string(0) ""
}
["point"] => object(stdClass)#11 (2) {
["x"] => string(12) "126.98909457"
["y"] => string(11) "46.64606393"
}
}
["status"] => int(0)
}
纯真库 :
array(5) {
["ip"] => string(13) "60.15.205.184"
["beginip"] => string(11) "60.15.205.0"
["endip"] => string(13) "60.15.205.255"
["country"] => string(30) "黑龙江省绥化市青冈县"
["area"] => string(6) "联通"
}
SINA:
object(stdClass)#8 (10) {
["ret"] => int(1)
["start"] => string(11) "60.15.128.0"
["end"] => string(13) "60.15.255.255"
["country"] => string(6) "中国"
["province"] => string(9) "黑龙江"
["city"] => string(6) "绥化"
["district"] => string(0) ""
["isp"] => string(6) "联通"
["type"] => string(0) ""
["desc"] => string(0) ""
}
TAOBAO:
object(stdClass)#8 (2) {
["code"] => int(0)
["data"] => object(stdClass)#9 (13) {
["country"] => string(6) "中国"
["country_id"] => string(2) "CN"
["area"] => string(6) "东北"
["area_id"] => string(6) "200000"
["region"] => string(12) "黑龙江省"
["region_id"] => string(6) "230000"
["city"] => string(9) "绥化市"
["city_id"] => string(6) "231200"
["county"] => string(9) "青冈县"
["county_id"] => string(6) "231223"
["isp"] => string(6) "联通"
["isp_id"] => string(6) "100026"
["ip"] => string(13) "60.15.205.184"
}
}
OIP:
array(5) {
["province"] => string(12) "黑龙江省"
["city"] => string(9) "绥化市"
["county"] => string(9) "青冈县"
["ip"] => string(13) "60.15.205.184"
["isp"] => string(6) "联通"
}
文件放在 ThinkPHP\Library\Org\Net\ 下使用方法.
$OIP = new \Org\Net\OnlineIpLocation(配置名);
$result = $OIP->getlocation(IP地址);
这样会返回你自己地址的信息.配置名是 sina,baidu,taobao(默认)
返回内容包含
province - 省
city - 市
county - 县/区/地级市等
isp - ISP
ip - IP