自己用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/"));
}
比较简单,没有做什么处理,只是替换了图片的地址。
posted @ 2011-11-30 13:27  与时俱进  阅读(735)  评论(0编辑  收藏  举报
友情链接:同里老宅院民居客栈