Note ** This is not a duplicate question ,it is unlike getting HTML code from html page
I have tried all the codes posted on this site that are used to get HTML code from a page into a string in android.But from all of the codes I've tried , non worked on a url of PHP webpage, for example (http://www.jonasweb.net/samples.php) . How can I do that ?
A sample code to get HTML source as 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();