java 获取网页源码

URL url = new URL("http","s.weibo.com",80,"/weibo/伊诺克Eliot&xsort=time&Refer=STopic_realtime&nodup=1&page=1") ;
InputStream input = url.openStream() ; // 打开输入流
Scanner scan = new Scanner(input) ; // 实例化Scanner类
scan.useDelimiter("\n") ; // 设置读取分隔符
while(scan.hasNext()){
System.out.println(scan.next()) ;
}

你可能感兴趣的:(java 获取网页源码)