自己用HttpWebRequest写的一个天气预报小偷
private void GetWeather()
{
HttpWebRequest request = (HttpWebRequest)WebRequest.Create("http://weather.news.qq.com/inc/dc189.htm");
request.Method = "Get";
request.ContentType = "application/x-www-form-urlencoded";
WebResponse response = request.GetResponse();
Stream s = response.GetResponseStream();
StreamReader sr = new StreamReader(s,System.Text.Encoding.GetEncoding("GB2312"));
string html = sr.ReadToEnd();
s.Close();
sr.Close();
Response.Write(html.Replace("/images/","http://weather.news.qq.com/images/"));
}
比较简单,没有做什么处理,只是替换了图片的地址。