Thread: WebPage status
View Single Post
  #1 (permalink)  
Old August 6th, 2008, 03:34 PM
cdaye99 cdaye99 is offline
Registered User
 
Join Date: Aug 2008
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Default 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


Reply With Quote