Beispiel #1
0
        public static TaoBaoAreaInfo GetIPAreaFromTaoBao(string strIPAddress)
        {
            TaoBaoAreaInfo result;

            if (ConfigUtils.GetAppSetting <bool>("IsReadIPArea"))
            {
                string strUrl = "http://ip.taobao.com/service/getIpInfo.php?ip=" + strIPAddress;
                result = JsonUtils.JsonToObject <TaoBaoAreaInfo>(NetWorkUtils.HttpGet(strUrl));
            }
            else
            {
                result = null;
            }
            return(result);
        }
Beispiel #2
0
        public static SinaIPAreaInfo GetIPAreaFromSina(string strIPAddress)
        {
            SinaIPAreaInfo result;

            if (ConfigUtils.GetAppSetting <bool>("IsReadIPArea"))
            {
                string strUrl = "http://int.dpool.sina.com.cn/iplookup/iplookup.php?format=json&ip=" + strIPAddress;
                result = JsonUtils.JsonToObject <SinaIPAreaInfo>(NetWorkUtils.HttpGet(strUrl));
            }
            else
            {
                result = null;
            }
            return(result);
        }
Beispiel #3
0
        public static string GetIPAreaFromPcOnline(string strIPAddress)
        {
            string result;

            if (ConfigUtils.GetAppSetting <bool>("IsReadIPArea"))
            {
                try
                {
                    result = NetWorkUtils.HttpGet("http://whois.pconline.com.cn/ip.jsp?ip=" + strIPAddress, "gb2312");
                    return(result);
                }
                catch
                {
                    result = "未知地址或者获取地址失败";
                    return(result);
                }
            }
            result = string.Empty;
            return(result);
        }