【发布时间】:2021-04-28 03:14:32
【问题描述】:
我使用以下函数来检查 RSS url 是否健康然后使用它:
function testUrl(url)
testUrl=0
Set o = CreateObject("MSXML2.XMLHTTP")
on error resume next
o.open "GET", url, false
o.send
if o.Status = 200 then testUrl = 1
on error goto 0
set o=nothing
end function
但是,当目标 URL 在短时间内没有响应时,我会收到超时错误。所以我想使用this Q/A中的以下函数在5秒后终止请求,如果没有成功响应但我不知道将asp_Wait(5)放在哪里以及如何在5秒后取消请求?我应该在o.send 或o.send 同步后放置asp_Wait 吗?
Function asp_Wait(nMilliseconds)
Dim oShell
Set oShell= Server.CreateObject("WScript.Shell")
Call oShell.run("ping 1.1.1.1 -n 1 -w " & nMilliseconds,1,TRUE)
End Function
【问题讨论】:
标签: vbscript asp-classic msxml2