Instructions:
Source code:
package com.whatever;
import com.meterware.httpunit.*;
public class GetLinks {
public static void main(String[] args) {
try {
WebLink[] links = new WebConversation().getResponse("http://www.google.com").getLinks();
for (int linkIndex = 0; linkIndex
System.out.println(links[linkIndex].getURLString());
}
} catch (Exception e) {
e.printStackTrace();
}
}
}
Output on April 15th, 2004:
/imghp?hl=en&tab=wi&ie=UTF-8
/grphp?hl=en&tab=wg&ie=UTF-8
/nwshp?hl=en&tab=wn&ie=UTF-8
/froogle?hl=en&tab=wf&ie=UTF-8
/froogle?hl=en&tab=wf&ie=UTF-8
/options/index.html
/advanced_search?hl=en
/preferences?hl=en
/language_tools?hl=en
/ads/
/services/
/about.html