WebPage status
I'm trying to verify a website is up or down by retrieving the status code using vbScript. I've seen the following example several times on the web, but get "unspecified error" for the line "strPageStat = Http.Status"
Below is the code. Any ideas on the error or another way to check if the website is functioning?
msgbox urlget("http://www.google.com")
Dim strPageStat
Function URLGet(URL)
Set Http = CreateObject("Microsoft.XMLHTTP")
Http.Open "GET", URL, True
Http.Send ()
strPageStat = Http.Status
if strPageStat = "200" then
URLGet="Error:"& strPageStat
else
' URLGet = Http.ResponseBody
URLGet = Http.responseText
end if
End Function
|