如何用java远程访问天气预报接口

如题所述

连接中央气象台的API URL url = new URL("http://m.weather.com.cn/data/" + Cityid + ".html"); URLConnection connectionData = url.openConnection(); connectionData.setConnectTimeout(1000);
温馨提示:答案为网友推荐,仅供参考
第1个回答  2017-01-17
用HttpConnected模拟http请求即可。
相似回答