I have a script that goes out to multiple webpages and returns an xml file from each. The issue I am having is if I am unable to connect to the website, it takes up to 30 seconds before it returns with an error it can't connect causing my script to take up to 2-3 minutes to run when it should be about 15 secs max.
If I use the following it works fine except for the long times as explained
err.clear
Dim HTTP
Set HTTP = CreateObject("MSXML2.XMLHTTP")
http.open "GET", URL, FALSE
http.setRequestHeader "Content-Type", "text/xml"
http.send
if(err.number <> 0) then
When I try to use the .timeout it will always skip straight through and say it can't connect when I know it can/does cause it will when I take it out. I tried the following:
Dim HTTP
Set HTTP = CreateObject("MSXML2.XMLHTTP")
HTTP.timeout = 10000
Http.ontimeout = timeo
http.open "GET", URL, FALSE
http.setRequestHeader "Content-Type", "text/xml"
http.send
if(err.number <> 0 or isnull(http.responsetext)) then
sdlf;jsalfdj;lsak;js
function timeo
wscript "timeout"
end function
Any ideas or better direction I can go?
Thanks