获取某个网页的内容

String urlContent = "";
StringBuffer is = new StringBuffer();
try {
URL myUrl = new URL("http://10.71.49.41/report-img/timestamp.txt");
BufferedReader br = new BufferedReader(new InputStreamReader(myUrl.openStream()));
String s;
while ((s = br.readLine()) != null) {
is.append(s);
}
urlContent = is.toString();
} catch (Exception e) {
e.printStackTrace();
}

你可能感兴趣的:(获取)