Open a URL, scan the page(look for certain words)

Hi

In java, how can I open an URL eg. http://www.google.com , then read that page meaning
search for certain words..and if those words exist I would output a message.

SB

ScarletBlueAsked:
Who is Participating?
 
override_y2kConnect With a Mentor Commented:
Do something like

String url = "http://yahoo.com

Then use javas openURL command to open it

........
    try {
    someutility.openURL(url);
    return;      
    }
........            

Also you will need to catch various exceptions.Then create a search tool that searches the page for a given word.

......
if(wordpresent = true) {
  System.out.println("Word is present");
}
....

Regards.

O2K
0
 
ScarletBlueAuthor Commented:
Hi CleanupPing
I have already accepted O2K's answer. It's written "Accepted Answer " in green. Please
confirm this.
thanx
scarlet
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.