Created
February 9, 2016 15:01
-
-
Save abbas-oveissi/7a2d41ffa6cf00917537 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//http://stackoverflow.com/questions/2423498/how-to-get-the-html-source-of-a-page-from-a-html-link-in-android | |
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(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment