import HTTPClient.HTTPResponse;
import HTTPClient.HTTPConnection;
public class HttpCallout {
public static void getURL( String hostname, String portnum, String url ) throws InterruptedException{
try {
String protocol = "http";
String host = hostname;
int port = Integer.parseInt(portnum);
String page = url;
HTTPConnection con = new HTTPConnection( protocol, host, port);
con.setTimeout(20000);
con.setAllowUserInteraction(false);
HTTPResponse rsp = con.Get(page);
con.stop();
} catch( Throwable ex ) {
ex.printStackTrace();
}
}
}
|