1 4 5 import java.net.URL ; 6 import java.util.Random ; 7 8 import javax.swing.text.html.HTMLDocument ; 9 10 import net.matuschek.html.HtmlDocument; 11 import net.matuschek.http.HttpConstants; 12 import net.matuschek.http.HttpDoc; 13 import net.matuschek.http.HttpTool; 14 15 import org.apache.log4j.BasicConfigurator; 16 17 26 27 28 29 30 public class TryIt { 31 32 static Random rand = new Random (); 33 34 public static String randomString() { 35 Integer i = new Integer (rand.nextInt(20000)); 36 return i.toString(); 37 } 38 39 public static void main(String [] args) 40 throws Exception 41 { 42 BasicConfigurator.configure(); 43 44 HttpTool tool = new HttpTool(); 45 HttpDoc doc = tool.retrieveDocument(new URL ("http://usul27:a1rrakis@www.atkpremium.com/members/styles/standard/pages/index.php?thispage=modelupdate&thisupdate=083735&thismodel=len004"), 46 HttpConstants.GET,null); 47 HtmlDocument html=new HtmlDocument(new URL ("http://localhost"), doc.getContent()); 48 for (URL u: html.getLinks()) { 49 System.out.println(u); 50 } 51 52 } 54 55 } | Popular Tags |