
April 27th, 2000, 11:47 PM
|
|
Junior Member
|
|
Join Date: Apr 2000
Posts: 8

Time spent in forums: < 1 sec
Reputation Power: 0
|
|
|
Hi,
I need to write a servlet which gets a specified web page and searches it's contents.
What is the best way to do this. I've read a jGuru posting which suggests using
URL url = new URL("http://www.someurl.com/logo.gif");
URLConnection connection = url.openConnection();
InputStream stream = connection.getInputStream();
BufferedInputStream in = new BufferedInputStream(stream);
FileOutputStream file = new FileOutputStream("logo.gif");
BufferedOutputStream out = new BufferedOutputStream(file);
int i;
while ((i = in.read()) != -1) {
out.write(i);
}
but as you can tell this grabs a file and stores it as a file. I need to get the web page and search it, not store it as a file. I am really new at this and would appreciate any assistance. Thank you.
plato
|