Possible Duplicate:
Is it possible to get the HTML code from WebView
I'm trying to make an app which needs to get the html code from a website, and go through the code to look for images. Where I'm at now gives me a html code back in the emulator, but it is a different code I get when I open the source code for the website on my computer.
public String getInternetData(String adresse) throws Exception{
BufferedReader in = null;
String data = null;
try{
HttpClient client = new DefaultHttpClient();
URI website = new URI(adresse);
HttpGet request = new HttpGet();
request.setURI(website);
HttpResponse response = client.execute(request);
in = new BufferedReader(new InputStreamReader(response.getEntity().getContent()));
StringBuffer sb = new StringBuffer("");
String l = "";
String nl = System.getProperty("line.separator");
while ((l = in.readLine()) !=null){
sb.append(l + nl);
}
in.close();
data = sb.toString();
return data;
}finally{
if (in != null){
try{
in.close();
return data;
}catch (Exception e){
e.printStackTrace();
}
}
}
}
The code I get in the emulator ends with something about enabling of JavaScript and Cookies being required. If this is my problem, how do I go about solving it?
Any help would be much appreciated!