根据一位网友写的java天气信息获取改编的,参考http://blog.csdn.net/lanpiao_87/article/details/41556265
class Weather
{
public static string GetWeatherXml(string source,int day) {
string dst = "";
string requestUrl = "http://php.weather.sina.com.cn/xml.php?city={keyWord}&password=DJOYnieT8234jlsK&day=0";//获取当天天气
requestUrl = requestUrl.Replace("{keyWord}", HttpRequestUtil.UrlEncode(source, "GBK"));
dst = HttpRequestUtil.HttpRequest(requestUrl);
return dst;
}
public static string GetWeatherInfo(string source) {
StringBuilder buffer = new StringBuilder();
buffer.Append(source).Append("今天的天气情况如下: \n\n");
string weatherXml = GetWeatherXml(source,0);
if (null == weatherXml || ""