如何获取网页URL的source code
发布网友
发布时间:2022-04-24 20:50
我来回答
共2个回答
热心网友
时间:2023-11-01 18:12
对于常规的网址如: http开头的:
URL oracle = new URL( url);
String test = oracle.toExternalForm();
String test1 = oracle.toString();
URI oracle1 = null;
try {
oracle1 = oracle.toURI();
} catch (URISyntaxException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
BufferedReader in = new BufferedReader(
new InputStreamReader(oracle.openStream()));
String inputLine;
String inputLine2 = "";
while ((inputLine = in.readLine()) != null)
inputLine2 +=inputLine;
in.close();
热心网友
时间:2023-11-01 18:12
你应该无法获取动态网站的源码,只能获取静态网站的源码,如果是进行URL重写的静态网站的源码,你也是无法获取的