根据经纬度获取天气信息
可用的接口:
http://m.weather.com.cn/d/town/index?lat=31.97958&lon=120.89371
http://m.weather.com.cn/d/town/today?lat=31.97958&lon=120.89371
public static String getToday(String log, String lat ){
//lat 小 log 大
//参数解释: 纬度,经度 type 001 (100代表道路,010代表POI,001代表门址,111可以同时显示前三项)
String urlString = "http://m.weather.com.cn/d/town/today?lat="+lat +"&" +"lon=" +log;
try {
URL url = new URL(urlString);
java.net.HttpURLConnection conn = (java.net.HttpURLConnection)url.openConnection();
conn.setDoOutput(true);
conn.setRequestMethod("GET");
//获取输入流
java.io.BufferedReader in = new java.io.BufferedReader(new java.io.InputStreamReader(conn.getInputStream(),"UTF-8"));
String line ;
StringBuffer buffer = new StringBuffer();
while ((line = in.readLine()) != null) {
buffer.append(line);
}
in.