| | |
| | | package com.yeshi.buwan.util; |
| | | |
| | | import com.show.api.ShowApiRequest; |
| | | import net.sf.json.JSONObject; |
| | | import org.apache.commons.httpclient.HttpClient; |
| | | import org.apache.commons.httpclient.HttpException; |
| | | import org.apache.commons.httpclient.methods.GetMethod; |
| | | |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import java.io.BufferedInputStream; |
| | | import java.io.IOException; |
| | | import java.io.UnsupportedEncodingException; |
| | | import java.net.URL; |
| | | import java.net.URLConnection; |
| | | import java.net.URLEncoder; |
| | | import java.util.HashMap; |
| | | import java.util.Map; |
| | | |
| | | import javax.servlet.http.HttpServletRequest; |
| | | |
| | | import com.show.api.ShowApiRequest; |
| | | import org.apache.commons.httpclient.HttpClient; |
| | | import org.apache.commons.httpclient.HttpException; |
| | | import org.apache.commons.httpclient.methods.GetMethod; |
| | | |
| | | import net.sf.json.JSONObject; |
| | | |
| | | public class IPUtil { |
| | | // http://verx.daili666.com/ip/?tid=558287898012218&num=1&operator=2 |
| | |
| | | return ip; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 获取远程端口 |
| | | * |
| | | * @param request |
| | | * @return |
| | | */ |
| | | public static int getRemotePort(HttpServletRequest request) { |
| | | return request.getRemotePort(); |
| | | } |
| | | |
| | | public static String getIPContry(String ip) { |
| | | IPInfo ipInfo = getIPInfo(ip); |
| | | return ipInfo == null ? "" : ipInfo.getCountry(); |