To retrieve the content from web page using JSP..
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Prashanth_R
Posted On:   Thursday, December 28, 2006 03:20 AM


How to send the querystring to google search page and retrieve the resultingt top ten links of the google search using JSP

Re: To retrieve the content from web page using JSP..

Posted By:   Bozhidar_Bozhanov  
Posted On:   Thursday, December 28, 2006 11:06 AM

public String check(String url) {
URL url = new URL (url);
BufferedReader r = new BufferedReader(new InputStreamReader(url.openStream()));

String line;
StringBuffer buff = new StringBuffer();
while ((line = r.readLine()) != null){
buff.append(line);
}
String content = new String(buff.toString());
return content;
}

This returns you the HTML contents of the page. Then you can parse them, or print them directly.
About | Sitemap | Contact