我無法通過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) {}
}
你可以發佈錯誤的堆棧跟蹤? –