- HttpWebRequest request = (HttpWebRequest)WebRequest.Create("http://ip.chinaz.com/getip.aspx");
- HttpWebResponse response = (HttpWebResponse)request.GetResponse();
- Stream recStream = response.GetResponseStream();
- Encoding gb2312 = Encoding.GetEncoding("gb2312");
- StreamReader sr = new StreamReader(recStream, gb2312);
- String content = sr.ReadToEnd();
- string s = content;
- int i = s.IndexOf("{ip:'") + 5;
- int j = s.IndexOf("',");
- string str = s.Substring(i, j - i + 0);
- hqip = str;
亲爱的:若该文章解决了您的问题,可否收藏+评论+分享呢?
文章评论 本文章有个评论