标题:
[其他]
求问这段批处理的作用
[打印本页]
作者:
ayhkys
时间:
2017-9-28 22:00
标题:
求问这段批处理的作用
function getHtmlTxt(url){
try{
var http = new ActiveXObject('MSXML2.XMLHTTP')
}
catch(e){
var http = new ActiveXObject('WinHttp.WinHttpRequest.5.1')
}
http.open('get', url, false)
http.send()
try{
var char = /chareset *?= *?([^\s;]+)/i.exec(http.getResponseHeader('content-type'))[1];
var htmltext = BintoStr(http.ResponseBody, char);
}catch(e){
try{
var char = /<meta .*?charset ?= ?\"?([^\s\"]+)/i.exec(http.ResponseText)[1];
var htmltext = BintoStr(http.ResponseBody, char);
}catch(e){
var htmltext = http.ResponseBody?http.ResponseBody:http.ResponseText;
}
}
return htmltext;
}
作者:
ayhkys
时间:
2017-9-28 22:07
<script>
var fso = new ActiveXObject('Scripting.Filesystemobject');
var StdIn = fso.GetStandardStream(0);
var StdOut = fso.GetStandardStream(1);
function BintoStr(strBin,strCharset){
try{
var stream = new ActiveXObject('ADODB.Stream')
stream.Type = 1
stream.Mode = 3
stream.Open()
stream.Write(strBin)
stream.Position = 0
stream.Type = 2
stream.Charset = strCharset
return stream.ReadText
}
catch(e){}
}
function getHtmlTxt(url){
try{
var http = new ActiveXObject('MSXML2.XMLHTTP')
}
catch(e){
var http = new ActiveXObject('WinHttp.WinHttpRequest.5.1')
}
http.open('get', url, false)
http.send()
try{
var char = /chareset *?= *?([^\s;]+)/i.exec(http.getResponseHeader('content-type'))[1];
var htmltext = BintoStr(http.ResponseBody, char);
}catch(e){
try{
var char = /<meta .*?charset ?= ?\"?([^\s\"]+)/i.exec(http.ResponseText)[1];
var htmltext = BintoStr(http.ResponseBody, char);
}catch(e){
var htmltext = http.ResponseBody?http.ResponseBody:http.ResponseText;
}
}
return htmltext;
}
加上开始这一段 谢谢大神
作者:
zhanglei1371
时间:
2017-9-29 06:51
这个就是获取网页源码文本啊,相当于网页右键---查看源代码,得到的内容
欢迎光临 批处理之家 (http://www.bathome.net/)
Powered by Discuz! 7.2