我无法通过ftp从此html文件中获取html文本。我使用美丽的汤通过http/https阅读html文件,但由于某些原因,我无法从ftp下载/读取。请帮忙!如何通过ftp url下载/阅读html文件?
这是网址。 a link
这是我的代码到目前为止。
BufferedReader reader = null;
String total = "";
String line;
ur = "ftp://ftp.legis.state.tx.us/bills/832/billtext/html/house_resolutions/HR00001_HR00099/HR00014I.htm"
try {
URL url = new URL(ur);
URLConnection urlc = url.openConnection();
InputStream is = urlc.getInputStream(); // To download
reader = new BufferedReader(new InputStreamReader(is, "UTF-8"));
while ((line = reader.readLine()) != null)
total += reader.readLine();
} finally {
if (reader != null)
try { reader.close();
} catch (IOException logOrIgnore) {}
}
你可以发布错误的堆栈跟踪? –