基于淘宝服务的 ip解析

测试代码

import com.yt17lu.commons.AddressUtils;

public class AddressUtilsTest {
	public static void main(String[] args) {
		AddressUtils au = new AddressUtils();
		String result = au.getResult("202.192.184.117");
		au.analysis(result);
		boolean success = au.isSuccess();
		if (success) {
			String city = au.get(AddressUtils.CITY);
			System.out.println(city);
		} else {
			System.out.println("解析失败");
		}
	}
}

结果为: 

{code=0, data={country=中国, country_id=CN, area=华南, area_id=800000, region=广东省, region_id=440000, city=佛山市, city_id=440600, county=, county_id=-1, isp=教育网, isp_id=100027, ip=202.192.184.117}}

 

 

 

你可能感兴趣的:(IP)