URL url = new URL("http://news.sina.com.cn/c/2002-02-25/1923485328.html");
URLConnection conn = url.openConnection(); conn.connect(); ///add this///long headdate = conn.getIfModifiedSince();
long headdate = conn.getLastModified(); // use this functionSystem.out.println(new Date(headdate));
不过有的网页就是0的,这样不太好办
我想知道网页为什么有的没有lastmodified
是否URL错了或者WEB服务器会自动判断若不是浏览器访问就拒绝访问.
是否URL错了或者WEB服务器会自动判断若不是浏览器访问就拒绝访问.:不会,我都找到有效的连接来测试