首页 白银价格 白银价格示例代码 白银价格历史查询[Java]

白银价格历史查询示例代码Java

作者: 阅读数:6651 上传时间:2026-06-11

白银价格历史查询

String url = "https://api.jisuapi.com/silver/history?market=london&startdate=2026-06-01&enddate=2026-06-10&appkey=yourappkey&type=xag";
URL obj = new URL(url);
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("GET");
BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
    response.append(inputLine);
}
in.close();
System.out.println(response.toString());