c# 获取天气预报信息
Uri uri = new Uri("http://api.liqwei.com/weather/?t=1");
WebRequest wreq = WebRequest.Create(uri);
HttpWebResponse wresp = (HttpWebResponse)wreq.GetResponse();
string HTML = ""; //最终包含天气信息的字符串
Stream s = wresp.GetResponseStream();
StreamReader objReader = new StreamReader(s, System.Text.Encoding.Default);
string sLine = "";
int i = 0;
while (sLine != null)
{
i++;
sLine = objReader.ReadLine();
if (sLine != null)
HTML += sLine;
}