Getting Text from a URL

try { // Create a URL for the desired page URL url = new URL("http://hostname:80/index.html"); // Read all the text returned by the server BufferedReader in = new BufferedReader(new InputStreamReader(url.openStream())); String str; while ((str = in.readLine()) != null) { // str is one line of text; readLine() strips the newline character(s) } in.close(); } catch (MalformedURLException e) { } catch (IOException e) { }

Comments

4 Feb 2010 - 1:46am by afroz arshee (not verified)

this code gives us the html formatted text but whr in i want the acctual text
how do i get it plz reply to me as soon as possible to afreaz@gmail.com

1 Mar 2010 - 10:36am by vmollov (not verified)

I tried this and it only works if the URL is on the same domain as the JSP page. Does anyone know a workaround for that problem?
Thank you!

23 May 2010 - 6:39am by THANX (not verified)

haha,exactly what i wanted,thanks a lot.keep it up!!

3 Sep 2010 - 12:55am by xieziwuyu (not verified)

Zero work gloves inventory leather gloves and hair products operation of truck crane foreign trade mobile crane is the road sweeper last diesel generator resort.

The first Gucci handbags to do Discount gucci handbags an English 网店代理 online 网店代理 shop, rent 男装批发 server space 女装批发 for the 香港機場接送服務 United States香港机场接送服务.

Post a comment

More information about formatting options

CAPTCHA
This question is for testing whether you are a human visitor and to prevent automated spam submissions.
Image CAPTCHA
Enter the characters shown in the image. Ignore spaces and be careful about upper and lower case.