So, I'm trying to create a URL-address to use httpget on, to download the page source. But I have problems every time I run the app, he says that I have an illegal character in the string / uri. Ive tried the code here.
String Search = "http://www.lala.com/";
and
HttpGet request = new HttpGet("http://www.lala.com/");
and every time I try,
Uri search = new Uri("http://www.lala.com/");
I get "Can not create a Uri instance."
I'm not sure what I'm doing wrong, and this is the code for the page source.
try { HttpClient client = new DefaultHttpClient(); HttpGet request = new HttpGet("http://www.lala.com/"); HttpResponse response = client.execute(request); 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(); } catch (IOException e1) { } "); try { HttpClient client = new DefaultHttpClient(); HttpGet request = new HttpGet("http://www.lala.com/"); HttpResponse response = client.execute(request); 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(); } catch (IOException e1) { } (); try { HttpClient client = new DefaultHttpClient(); HttpGet request = new HttpGet("http://www.lala.com/"); HttpResponse response = client.execute(request); 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(); } catch (IOException e1) { } )! = null) try { HttpClient client = new DefaultHttpClient(); HttpGet request = new HttpGet("http://www.lala.com/"); HttpResponse response = client.execute(request); 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(); } catch (IOException e1) { }
Thanks for the help! ~ Tanner.
(Lala.com is not a site that uses btw: P)
source share