Beispiel #1
0
    protected string GetAddressByIp(string ip)
    {
        // string ip = TextBox1.Text.ToString().Trim(); //"115.193.217.249";
        string PostUrl = "http://int.dpool.sina.com.cn/iplookup/iplookup.php?ip=" + ip;
        string res     = SystemTool.GetDataByPost(PostUrl);//该条请求返回的数据为:res=1\t115.193.210.0\t115.194.201.255\t中国\t浙江\t杭州\t电信

        SystemTool.SaveTxtInfo(res, "log/res.txt");
        if (res.Contains("-"))
        {
            return("");
        }
        string[] arr = SystemTool.getAreaInfoList(res);
        if (arr.Length > 2)
        {
            return(arr[0] + arr[1].ToString().Trim() + arr[2].ToString());
        }
        else
        {
            return("");
        }
    }