private string getWeather(string cityName) { int i = 0; string Json = ""; Exception e = new Exception(); GetHTTPInfo httpInfo = new GetHTTPInfo(); try { string formateLocationInfo = System.Web.HttpUtility.UrlEncode(cityName); Json = httpInfo.GetHttpResponse("https://free-api.heweather.com/v5/weather?key=54084bfdb366446d85186ee1e80feb10&city=" + formateLocationInfo); } catch (Exception exp) { e = exp; return(e.Message); } //AnalysisWeatherXML awx = new AnalysisWeatherXML(); //WeatherInfo weatherInfo = new WeatherInfo(); //try //{ // weatherInfo = awx.getWeatherInfo(xml); //} //catch (Exception exp) //{ //} return(Json); }
private string GetLocation(string location) { GetHTTPInfo gti = new GetHTTPInfo(); string locationJosn = gti.GetHttpResponseStr("api.map.baidu.com", "/geocoder/v2/?ak=VH2DX08lCi15Y1AxETUICD9zV8DnmHEg&location=" + location + "&output=json&pois=1"); return(locationJosn); }