Visual Basic Is It Down Website Checker

Introduction: So this tutorial is going to be on how to make a simple script to check if a website is on-line or not. Steps of Creation: Step 1: First let's import System.IO and System.Net:
  1. Imports System.Net
  2. Imports System.IO
Step 2: Now, lets create a request to downforeveryoneorjustme.com. The website gets the URL to check from the URL itself so we can simply modify the URL to correspond to textbox1.text.
  1.     Try
  2.         Dim r As HttpWebRequest = HttpWebRequest.Create("http://www.downforeveryoneorjustme.com/" & TextBox1.Text)
  3.     Catch ex As WebException
  4.         MsgBox("It's probably your connection... Unable to connect to downforeveryoneorjustme.com")
  5.     End Try
Step 3: Let's next get the response and read to a String.
  1.     Try
  2.         Dim r As HttpWebRequest = HttpWebRequest.Create("http://www.downforeveryoneorjustme.com/" & TextBox1.Text)
  3.         Dim re As HttpWebResponse = r.GetResponse()
  4.         Dim src As String = New StreamReader(re.GetResponseStream()).ReadToEnd()
  5.     Catch ex As WebException
  6.         MsgBox("It's probably your connection... Unable to connect to downforeveryoneorjustme.com")
  7.     End Try
Step 4: Finally, let's check to see if the page contains "It's just you" or not and report the result.
  1.     Try
  2.         Dim r As HttpWebRequest = HttpWebRequest.Create("http://www.downforeveryoneorjustme.com/" & TextBox1.Text)
  3.         Dim re As HttpWebResponse = r.GetResponse()
  4.         Dim src As String = New StreamReader(re.GetResponseStream()).ReadToEnd()
  5.         If (src.Contains("It's just you.")) Then
  6.             MsgBox(TextBox1.Text & " is Online")
  7.         Else : MsgBox(TextBox1.Text & " is Offline")
  8.         End If
  9.     Catch ex As WebException
  10.         MsgBox("It's probably your connection... Unable to connect to downforeveryoneorjustme.com")
  11.     End Try
Project Complete! That's it! Below it the full source code and project download.
  1. Imports System.Net
  2. Imports System.IO
  3. Public Class Form1
  4.     Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
  5.         Try
  6.             Dim r As HttpWebRequest = HttpWebRequest.Create("http://www.downforeveryoneorjustme.com/" & TextBox1.Text)
  7.             Dim re As HttpWebResponse = r.GetResponse()
  8.             Dim src As String = New StreamReader(re.GetResponseStream()).ReadToEnd()
  9.             If (src.Contains("It's just you.")) Then
  10.                 MsgBox(TextBox1.Text & " is Online")
  11.             Else : MsgBox(TextBox1.Text & " is Offline")
  12.             End If
  13.         Catch ex As WebException
  14.             MsgBox("It's probably your connection... Unable to connect to downforeveryoneorjustme.com")
  15.         End Try
  16.     End Sub
  17. End Class
Note: Credit to the downforeveryoneorjustme.com creators.

Add new comment