我正在尝试编写一个VBScript,该外观看起来可以根据该网站的内容来浏览该网站。为此,我需要能够将每个网页的源代码分配给一个字符串变量,并使脚本在该字符串中查找某些单词。
我认为这是一个解决方案:
Function GetSourceCode(url)
Set objHttp = CreateObject("Microsoft.XMLHTTP")
bGetAsAsync = False
objHttp.open "GET", url, bGetAsAsync
objHttp.send
If objHttp.status <> 200 Then
wscript.Echo "unexpected status = " & objHttp.status & vbCrLf & objHttp.statusText
wscript.Quit
End If
'MsgBox objHttp.responseText
GetSourceCode = objHttp.responseText
End Function
但这不起作用。我在其他地方看到过,AutoIT可以做到这一点,但是我无法根据每个安全策略使用AutoIT。
有什么想法吗?