比如:
public static void main(String[] args) {
HttpUrlTest hut = new HttpUrlTest();
HttpURLConnection ucon = null;
String url = "http://www.u713.com/";
System.out.println(url);
URL turl;
try {
turl = new URL(url);
try {
ucon = (HttpURLConnection) turl.openConnection();
} catch (IOException e) {
e.printStackTrace();
}
ucon.setDoInput(true);
ucon.setDoOutput(true);
System.out.println("ooxx:" + ucon.getHeaderFields());
System.out.println("ooxx:" + ucon.getDate());
} catch (MalformedURLException e) {
e.printStackTrace();
}
}