获取*IP

            string tempip = "";
            try
            {
                HttpWebRequest wr = (HttpWebRequest)System.Net.WebRequest.Create("http://iframe.ip138.com/ic.asp");
                Stream s = wr.GetResponse().GetResponseStream();
                StreamReader sr = new StreamReader(s, Encoding.Default);
                string all = sr.ReadToEnd();

                int start = all.IndexOf("[") + 1;
                int end = all.IndexOf("]", start);
                tempip = all.Substring(start, end - start);
                sr.Close();
                s.Close();
            }
            catch
            {

            }
            return tempip;

原文地址:https://www.cnblogs.com/AllUserBegin/p/3510195.html