string rl; 
WebRequest myReq 
= WebRequest.Create("http://weather.news.qq.com/inc/ss125.htm"); 
WebResponse myRes 
= myReq.GetResponse(); 
Stream resStream 
= myRes.GetResponseStream(); 
StreamReader sr 
= new StreamReader(resStream, Encoding.Default); 
StringBuilder sb 
= new StringBuilder(); 
while ((rl = sr.ReadLine()) != null

sb.Append(rl); 

string abc = "<td height=\"23\" align=\"center\"><img src=\"/images/tem1.gif\" width=\"57\" height=\"13\"></td><td height=\"23\" align=\"center\">"
string bcd = "<td height=\"23\" width=\"117\" background=\"/images/r_tembg5.gif\" align=\"center\">"
string regexStr = @"" + abc + "([^<]*)</td>"
Match mc 
= Regex.Match(sb.ToString(), regexStr, RegexOptions.IgnoreCase); 
string regexStr1 = @"" + bcd + "([^<]*)</td>"
Match mc1 
= Regex.Match(sb.ToString(), regexStr1, RegexOptions.IgnoreCase); 
this.Label1.Text = "气温 " + mc.Groups[1].Value + " " + mc1.Groups[1].Value; 
myRes.Close(); 

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2021-11-29
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-12-06
猜你喜欢
  • 2021-11-11
  • 2021-08-12
  • 2022-12-23
  • 2022-12-23
  • 2021-10-16
  • 2022-02-07
相关资源
相似解决方案