Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Dim strWebsite
- strWebsite = "www.nshispeed.nl/ifo/ifo/amsterdamcs"
- If PingSite( strWebsite ) Then
- exitCode = 0
- WScript.Quit (exitCode Mod 255)
- Else
- exitCode = 1
- WScript.Quit (exitCode Mod 255)
- End If
- Function PingSite( myWebsite )
- ' This function checks if a website is running by sending an HTTP request.
- ' If the website is up, the function returns True, otherwise it returns False.
- ' Argument: myWebsite [string] in "www.domain.tld" format, without the
- ' "http://" prefix.
- '
- ' Written by Rob van der Woude
- ' http://www.robvanderwoude.com
- Dim intStatus, objHTTP
- Set objHTTP = CreateObject( "WinHttp.WinHttpRequest.5.1" )
- objHTTP.Open "GET", "http://" & myWebsite & "/", False
- objHTTP.SetRequestHeader "User-Agent", "Mozilla/4.0 (compatible; MyApp 1.0; Windows NT 5.1)"
- On Error Resume Next
- objHTTP.Send
- intStatus = objHTTP.Status
- On Error Goto 0
- If intStatus = 200 Then
- PingSite = True
- Else
- PingSite = False
- End If
- Set objHTTP = Nothing
- End Function
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement