用VBS获取网页源代码.vbs
set http=createobject("Microsoft.XMLHTTP") '\\调用XMLHTTP对象
url="http://www.119880.com/qq.txt" '\\赋予变量URL值
Set hhh = createObject("Microsoft.XMLHTTP")
hhh.open "get",url,false '\\定义打开URL方式
hhh.send '\\发送数据
zhi=zhuanghuan(Http.responsebody) '\\变量zhi等于网页内容
Set fso = Wscript.CreateObject("Scripting.FileSystemObject") '声明
Set f = fso.CreateTextFile("txtx.txt") '创建文件,其中f可任意,包含缩略名
f.WriteLine(zhi) '写文件内容,该命令功能太简单,目前看来只能用于TXT文件
f.Close
Function zhuanghuan(vIn)
strReturn = ""
For i = 1 To LenB(vIn)
ThisCharCode = AscB(MidB(vIn,i,1))
If ThisCharCode < &H80; Then
strReturn = strReturn & Chr(ThisCharCode)
Else
NextCharCode = AscB(MidB(vIn,i+1,1))
strReturn = strReturn & Chr(CLng(ThisCharCode) * &H100; + CInt(NextCharCode))
i = i + 1
End If
Next
zhuanghuan = strReturn
End Function
1