百度的html代码是什么,百度⽹页源代码是什么?
2017-07-28
Java抓取⽹页的内容代码是什么
public static String getHtmlReadLine(String httpurl){
String CurrentLine=”";
String TotalString=”";
InputStream urlStream;
String content=”";
try {
URL url = new URL(httpurl);
HttpURLConnection connection = (全部
public static String getHtmlReadLine(String httpurl){
String CurrentLine=”";
String TotalString=”";
InputStream urlStream;
String content=”";
try {
URL url = new URL(httpurl);
sugarinfo。net/dissertation/gctinfo/“);
HttpURLConnection connection = (HttpURLConnection)url。openConnection();
connection。
connect();
urlStream = connection。getInputStream();
BufferedReader reader = new BufferedReader(
new InputStreamReader(urlStream,”utf-8″));
while ((CurrentLine = reader。
readLine()) != null) {
TotalString += CurrentLine+”\n”;html导航源码
/**换⾏的地⽅主要是在这⾥**/
}
content = TotalString; // System。
out。println(content); } catch (Exception e) { e。printStackTrace(); }
return content;
}。收起

版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系QQ:729038198,我们将在24小时内删除。