I'm just starting out on my Networking Assignment and I'm already stuck.
Assignment asks me to check a the user provided website for links and to determine if they are active or inactive by reading the header info.
So far after googling, I just have this code which retrieves the website. I don't get how to go over this information and look for HTML links.
Here's the code:

import java.net.*;
import java.io.*;

public class url_checker {
    public static void main(String[] args) throws Exception {
        URL yahoo = new URL("http://yahoo.com");
        URLConnection yc = yahoo.openConnection();
        BufferedReader in = new BufferedReader(
                                new InputStreamReader(
                                yc.getInputStream()));
        String inputLine;
        int count = 0;
        while ((inputLine = in.readLine()) != null) {
            System.out.println (inputLine);               
            }      
        in.close();
    }
}

Please help.

Well, rather than simply googling for finished code, you should be reading tutorials and the API docs. See the API docs for URLConnection for info on how to get the headers, and there is a link in there to follow that will give you information about headers in general. Do a little reading and you should be able to figure it out.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.