Created
June 7, 2009 06:50
-
-
Save relrod/125201 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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