Skip to content

Instantly share code, notes, and snippets.

@relrod
Created June 7, 2009 06:50
Show Gist options
  • Save relrod/125201 to your computer and use it in GitHub Desktop.
Save relrod/125201 to your computer and use it in GitHub Desktop.
Public Function checksite(ByVal site As String)
Dim request As HttpWebRequest
Dim response As HttpWebResponse = Nothing
Dim reader As StreamReader
Dim output As String
Try
request = DirectCast(WebRequest.Create("http://downforeveryoneorjustme.com/" & site), HttpWebRequest)
response = DirectCast(request.GetResponse, HttpWebResponse)
reader = New StreamReader(response.GetResponseStream())
output = reader.ReadToEnd()
If output.Contains("It's just you.") Then
Return site & " appears up to me."
Else
Return site & " is down :(."
End If
Finally
If Not response Is Nothing Then response.Close()
End Try
End Function
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment