Visual Basic Is It Down Website Checker
Submitted by Yorkiebar on Friday, September 6, 2013 - 12:56.
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:
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.
Step 3:
Let's next get the response and read to a String.
Step 4:
Finally, let's check to see if the page contains "It's just you" or not and report the result.
Project Complete!
That's it! Below it the full source code and project download.
Note: Credit to the downforeveryoneorjustme.com creators.
- Imports System.Net
- Imports System.IO
- Try
- Dim r As HttpWebRequest = HttpWebRequest.Create("http://www.downforeveryoneorjustme.com/" & TextBox1.Text)
- Catch ex As WebException
- MsgBox("It's probably your connection... Unable to connect to downforeveryoneorjustme.com")
- End Try
- Try
- Dim r As HttpWebRequest = HttpWebRequest.Create("http://www.downforeveryoneorjustme.com/" & TextBox1.Text)
- Dim re As HttpWebResponse = r.GetResponse()
- Dim src As String = New StreamReader(re.GetResponseStream()).ReadToEnd()
- Catch ex As WebException
- MsgBox("It's probably your connection... Unable to connect to downforeveryoneorjustme.com")
- End Try
- Try
- Dim r As HttpWebRequest = HttpWebRequest.Create("http://www.downforeveryoneorjustme.com/" & TextBox1.Text)
- Dim re As HttpWebResponse = r.GetResponse()
- Dim src As String = New StreamReader(re.GetResponseStream()).ReadToEnd()
- If (src.Contains("It's just you.")) Then
- MsgBox(TextBox1.Text & " is Online")
- Else : MsgBox(TextBox1.Text & " is Offline")
- End If
- Catch ex As WebException
- MsgBox("It's probably your connection... Unable to connect to downforeveryoneorjustme.com")
- End Try
- Imports System.Net
- Imports System.IO
- Public Class Form1
- Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
- Try
- Dim r As HttpWebRequest = HttpWebRequest.Create("http://www.downforeveryoneorjustme.com/" & TextBox1.Text)
- Dim re As HttpWebResponse = r.GetResponse()
- Dim src As String = New StreamReader(re.GetResponseStream()).ReadToEnd()
- If (src.Contains("It's just you.")) Then
- MsgBox(TextBox1.Text & " is Online")
- Else : MsgBox(TextBox1.Text & " is Offline")
- End If
- Catch ex As WebException
- MsgBox("It's probably your connection... Unable to connect to downforeveryoneorjustme.com")
- End Try
- End Sub
- End Class
Add new comment
- 86 views