命令行方式读取WEB页面
2011-4-27编辑:lily
view-webrun.vbs
dim URL, oArgs
2
3 Set oArgs = WScript.Arguments
4
5 if oArgs.Count = 0 then
6 msgbox("错误:必须有URL")
7 wscript.quit 1
8 end if
9
10 URL = oArgs(0)
11
12 on error resume next
13 Set objXML = CreateObject("MSXML2.ServerXMLHTTP")
14
15 if err then
16 msgbox("Error: " & err.description)
17 wscript.quit 1
18 end if
19
20 ' 连接远程机器并取回页面内容
21 objXML.open "GET", URL, False
22
23 objXML.send()
24
25 ' 返回结果
26 msgbox objXML.responSetext
27
28 ' 清场
29 Set objXML = Nothing