之前看到了免费的
接口 所以试试是不是能用 ,
发现可以用 我用的java写的
class="java" name="code">package test;
import java.io.BufferedReader;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.URL;
public class TestWeath {
/**
* @param args
*/
public static void main(String[] args) {
String url = "http://www.weather.com.cn/data/sk/101010100.html";
try {
URL weathUrl = new URL(url);
HttpURLConnection connection = (HttpURLConnection)weathUrl.openConnection();
InputStream in = connection.getInputStream();
BufferedReader reader = new BufferedReader(new InputStreamReader(in,"utf-8"));
String result = reader.readLine();
in.close();
reader.close();
System.out.println(result);
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
还蛮方便的 适合简单的那种 至于复杂的现在还没找!先
应付再说 嘿嘿
- 大小: 15 KB