PAIP.提升安全性COOKIE绑定IP与城市与运营商

 

PAIP.提升安全性----COOKIE绑定IP与城市与运营商

 

前言... 1

腾讯的接口... 1

新浪的接口... 1

geobytes.com api2

IP数据库就用纯真的... 3

网易有道IP地址API接口... 3

参考... 4

 

 

前言

目前IP已经可以定位到城市的区县..以及运营商(电信,联通等)

个人觉得SINA的比较详细

 

 

腾讯的接口

返回数组 http://fw.qq.com/ipaddress

返回值 var IPData = new Array("61.135.152.194","","北京市","");

 

 

新浪的接口

  http://int.dpool.sina.com.cn/iplookup/iplookup.php?format=js 多地域测试方法:http://int.dpool.sina.com.cn/iplookup/iplookup.php?format=js&ip=218.192.3.42

返回值 var remote_ip_info = {"ret":1,"start":"218.192.0.0","end":"218.192.7.255","country":"\u4e2d\u56fd","province":"\u5e7f\u4e1c","city":"\u5e7f\u5dde","district":"","isp":"\u6559\u80b2\u7f51","type":"\u5b66\u6821","desc":"\u5e7f\u5dde\u5927\u5b66\u7eba\u7ec7\u670d\u88c5\u5b66\u9662"};

JSON格式

http://int.dpool.sina.com.cn/iplookup/iplookup.php?format=json&ip=218.192.3.42

 

 

geobytes.com api

补充一点:在网上找到另外一种方法:
代码如下:
$ip = $_SERVER['REMOTE_ADDR'];//这里的ip可以是你自定义的ip
$geoInfo = get_meta_tags(http://www.geobytes.com/IpLocator.htm?GetLocation&template=php3.txt&IpAddress=$ip);
/*
返回的数组信息如下,不过是英文版本的
Array
(
[known] => true //IP地址是否可知,即是否有收录;
[locationcode] => CNGDGUAN //地址位置的代码,包含了国家、省份和城市;
[fips104] => CH //美国联邦信息处理标准的国家代码;
[iso2] => CN //iso2标准的国家代码;
[iso3] => CHN //iso标准的国家代码;
[ison] => 156 //用途未明
[internet] => CN //也是国家代码
[countryid] => 49 //国家ID
[country] => China //国家名称;
[regionid] => 1361 //地区的id,即省份;
[region] => Guangdong //地区名称,即省份名称;
[regioncode] => GD //地区的代码或者缩写;
[adm1code] => CH30 //不清楚其含义;
[cityid] => 3539 //城市的ID
[city] => Guangzhou //城市的名称;
[latitude] => 23.1170 //纬度;
[longitude] => 113.2500 //经度;
[timezone] => +08:00 //时区;
[certainty] => 78 //不清楚其含义;
)
*/

 

 

 

 

 

 

 

IP数据库就用纯真的

 

amespace ShowIP
{
class IPReader
{
static private string _dataPath = "./QQWry.Dat ";

 

 

参考

急!如何根据ip地址取得所在城市的信息? - .NET技术 - ASP.NET    CSDN

 

 

 

网易有道IP地址API接口

查询IP地址:

http://www.youdao.com/smartresult-xml/search.s?type=ip&q=IP地址

举例:

http://www.youdao.com/smartresult-xml/search.s?type=ip&q=115.156.238.114

返回xml文本信息:

1.              <?xml version="1.0" encoding="gbk"?>

2.              <smartresult>

3.              <product type="ip">

4.              <ip>115.156.238.114</ip>

5.              <location>湖北省武汉市 教育网</location>

6.              </product>

7.              </smartresult>

 

 

 

 

参考

新浪网易IP地区信息查询API接口调用方法

《通过纯真IP数据库获取IP地址对应的地区信息》

 

 

原文地址:https://www.cnblogs.com/attilax/p/15199840.html