标签:
获取百度首页html文件
var http=require("http"); var options={ hostname:"www.baidu.com", port:"80", path:"/" }; function handleResponse(response){ response.on("data",(chunk)=>{ serverData+=chunk; }); response.on("end",()=>{ console.log(serverData); }); } http.get(options,(response)=>{ handleResponse(response); }).on("error",(err)=>{ console.log(err.message) });
标签:
原文地址:http://www.cnblogs.com/realsoul/p/5634590.html