Q:

JAVA: How to check if website document contains a word? 

I currently have the follow method:
try {
           URL url = new URL("http://auth.h.gp/HAKUNA%20MATATA.txt");
           Scanner s = new Scanner(url.openStream());
        }
        catch(IOException ex) {
           BotScript.log("Something went wrong =/ Error code:");
           ex.printStackTrace();
           stop();
        }

However, how do I check if it contains a word?  I've never worked with Scanners before and I found this snippet online. 
Thank you. 

A:

Okay, that looks good so far. 
You can then use Scanner's next() method to get each word.  You can also query hasNext() to see if there's another token available to avoid errors. 
boolean foundPumbaa = false;
while (s.hasNext()) {
    if (s.next().equalsIgnoreCase("pumbaa")) {
        foundPumbaa = true;
        System.out.println("We found Pumbaa"); // do something
        break;
    }
}
if (! foundPumbaa) {
    System.out.println("We didn't find Pumbaa");
}

EDIT in response to comment:
Yes, you can turn the text into a String.  The best way to do this is probably with a BufferedReader. 
From the Java Tutorial, "Reading Directly from a URL":

The following small Java program uses openStream() to get an input
  stream on the URL http://www.oracle.com/. It then opens a
  BufferedReader on the input stream and reads from the BufferedReader
  thereby reading from the URL.  Everything read is copied to the
  standard output stream:
import java.net.*; 
import java.io.*; 

public class URLReader {
    public static void main(String[] args) throws Exception {

        URL oracle = new URL("http://www.oracle.com/");
        BufferedReader in = new BufferedReader(
        new InputStreamReader(oracle.openStream()));

        String inputLine;
        while ((inputLine = in.readLine()) ! = null)
            System.out.println(inputLine);
        in.close();
    }
}

In a real program, instead of main throws Exception, you'd have that in a try-catch block and catch an IOException and some various URLExceptions.  But this should get you started.