我在MySQL数据库中有大约30K的IP地址(IPv4)。获取有关IP地址的数据
我想获得有关这些IP信息,如
国家 市等
我试图IP到国家数据库,它们不是很准确,是错误的多个IP。
Web API不允许这些IP查询,也可能不准确。
我想要准确的信息。 (ATLEAST国家应准确)
我对Java的后端,PHP/HTML5显示
请帮助。
我在MySQL数据库中有大约30K的IP地址(IPv4)。获取有关IP地址的数据
我想获得有关这些IP信息,如
国家 市等
我试图IP到国家数据库,它们不是很准确,是错误的多个IP。
Web API不允许这些IP查询,也可能不准确。
我想要准确的信息。 (ATLEAST国家应准确)
我对Java的后端,PHP/HTML5显示
请帮助。
我认为maxmind可能是事实上的geoip数据库。他们offer a free one在国家层面上准确率为99.5%,在城市层面上准确率为78%。
他们有php和java库。 http://www.maxmind.com/app/ip-location
我不知道“非常”准确。他们声称“在40公里半径范围内,美国在全国范围内超过99.5%,在美国城市范围内达到78%”,但在我所在地区表现良好。 – mpen 2012-08-17 15:21:11
国家信息对于一些“国际”互联网提供商是准确的(例如美国在线,它们是否还存在?)。 AOL通过它们向用户提供美国IP地址和/或通过代理的数据。对于大多数客户,国家信息应该是正确的。你也会得到ISP。您可以从“特殊”ISP过滤IP,并根据需要以不同的方式处理它们。 – SDwarfs 2012-08-17 15:27:43
我正在使用[链接] http://firestats.cc/wiki/ip2c这是多次错误我手动检查。我现在试试Maxmind geoip。但我已经看到即使在经纬度和互联网服务提供商也能获得确切信息的在线网站。 – User1234 2012-08-17 15:33:12
试试这个,它就像魔法 ...........
Key和Secret:
private final String key = "86b780aec0cee918718d7eb2fa084df412771c17";
private final String secret = "d3e3fa0a1fc6a35ac02aa591ed32ecaa750df9a7";
方法来创建会话:
public void xmlCreateSession(){
String createSession = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>"+"\n"+"<request>"+"\n"+"<token>"+"</token>"+"\n"+"<key>"+this.getKey()+"</key>"+"\n"+"<secret>"+this.getSecret()+"</secret>"+"\n"+"</request>";
firingUrl = "https://int.yumzing.com/index.php?func=sessionCreate";
// firingUrl = "http://199.87.235.147/sessionCreate";
//firingUrl = "https://int.yumzing.com/sessionCreate";
String tempCreate = postData(firingUrl, createSession);
this.getMToken(tempCreate);
System.out.println("getToken value "+this.getToken());
}
方法查找IP:
public void xmlUserIp(){
String userIp = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>"+"\n"+"<request>"+"\n"+"<token>"+this.getToken()+"</token>"+"\n"+"</request>";
firingUrl = "https://int.yumzing.com/index.php?func=userIp";
String tempIp = postData(firingUrl, userIp);
this.getMIp(tempIp);
System.out.println("getToken value "+this.getIp());
}
方法得到的信息基础上的IP:
public void xmlUserLocation(){
this.xmlUserIp();
System.out.println("With in xmlUserLocation-"+this.getToken()+" "+this.getIp());
String userLocation = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>"+"\n"+"<request>"+"\n"+"<token>"+this.getToken()+"</token>"+"\n"+"<ip>"+this.getIp()+"</ip>"+"\n"+"</request>";
firingUrl = "https://int.yumzing.com/?func=userLocation";
System.out.println("With in xmlUserLocation-"+this.getToken()+" "+this.getIp());
String tempLoc = postData(firingUrl, userLocation);
System.out.println("In xmluserLoc"+tempLoc);
this.getMLocation(tempLoc);
System.out.println("getToken value "+this.getCountry());
System.out.println("getToken value "+this.getState());
System.out.println("getToken value "+this.getCity());
System.out.println("getToken value "+this.getLatitude());
System.out.println("getToken value "+this.getLongitude());
}
非常感谢我会试试这个:) – User1234 2012-08-17 15:40:39
你也许可以得到该国,但你不会得到任何东西到准确。 – romo 2012-08-17 15:19:53
我以前使用Maxmind GeoIP,它工作得很好。 http://www.maxmind.com/app/city如果你想要更多的准确性,你将不得不支付$$$ – mpen 2012-08-17 15:20:05