【发布时间】:2013-01-22 15:51:20
【问题描述】:
在我的 android 应用程序中,我使用 asynctask 从网站获取 html 源代码。 为此,我使用 HttpURLConnection :
protected Void doInBackground(Void... v) {
try {
URL url = new URL("http://xx.com/test.pl");
HttpURLConnection httpURLConnection = (HttpURLConnection) url.openConnection();
InputStream inputStream = httpURLConnection.getInputStream();
BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(inputStream));
String temp;
while ((temp = bufferedReader.readLine()) != null) {
//Pattern pattern = Pattern.compile("&sid=(.*?)\"");
//Matcher match = pattern.matcher(temp);
System.out.println(temp);
Log.e("temp_HoleKunde", temp);
}
}
catch(Exception exe) {
exe.printStackTrace();
}
return null;
}
我在解析网站时总是使用它,它总是运行得非常好。 但现在我有一个非常严重的问题。我登录 logcat 的源代码不是完整的源代码。只有一半显示......或更多,有时更少。 如何在浏览器上获取完整的源代码?
【问题讨论】:
标签: android html android-asynctask httpurlconnection