请我想一个非常简单的方法来从我的android应用程序读取我的php页面的内容!我不需要jSon之类的东西,我想要的就是让php页面的内容在Java中成为String!预先谢谢你!
HttpClient client = new DefaultHttpClient(); HttpGet request = new HttpGet(url); HttpResponse response = client.execute(request);
String html = ""; InputStream in = response.getEntity().getContent(); BufferedReader reader = new BufferedReader(new InputStreamReader(in)); StringBuilder str = new StringBuilder(); String line = null; while((line = reader.readLine()) != null) { str.append(line); } in.close(); html = str.toString(); Log.i('HtmlContent',+html)