欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

asp.net實現(xiàn)根據(jù)城市獲取天氣預(yù)報的方法

 更新時間:2015年12月04日 12:29:42   作者:happy664618843  
這篇文章主要介紹了asp.net實現(xiàn)根據(jù)城市獲取天氣預(yù)報的方法,涉及asp.net調(diào)用新浪接口獲取天氣預(yù)報信息的實現(xiàn)技巧,非常簡單實用,需要的朋友可以參考下

本文實例講述了asp.net實現(xiàn)根據(jù)城市獲取天氣預(yù)報的方法。分享給大家供大家參考,具體如下:

public void GetWetheaerByCity(string cityName) {
  string city = cityName;
  string mycity = HttpUtility.UrlEncode(city, System.Text.Encoding.GetEncoding("GB2312"));
  System.Net.HttpWebRequest request = (System.Net.HttpWebRequest)System.Net.WebRequest.Create("http://www.sina.com/index.php?city=" + cityName);
  //HttpWebRequest 對象 獲取GetResponse 轉(zhuǎn)換成HttpWebResponse
  System.Net.HttpWebResponse response = request.GetResponse() as System.Net.HttpWebResponse;
  //通過HttpWebResponse response.GetResponseStream()獲取輸出流
  Stream str = response.GetResponseStream();
  StreamReader reader = new StreamReader(str, System.Text.Encoding.GetEncoding("GB2312"));
  string weathhtml = reader.ReadToEnd();
  str.Close();
  reader.Close();
}

希望本文所述對大家asp.net程序設(shè)計有所幫助。

相關(guān)文章

最新評論