![]() |
|
[.NET] [TUT] Check if a website is up or Down [EASY][SOURCE CODE][VB.NET] - Printable Version +- Hack Forums (https://hackforums.net) +-- Forum: Tech (https://hackforums.net/forumdisplay.php?fid=444) +--- Forum: Coding (https://hackforums.net/forumdisplay.php?fid=151) +---- Forum: Software Development (https://hackforums.net/forumdisplay.php?fid=118) +---- Thread: [.NET] [TUT] Check if a website is up or Down [EASY][SOURCE CODE][VB.NET] (/showthread.php?tid=1696417) |
[TUT] Check if a website is up or Down [EASY][SOURCE CODE][VB.NET] - Gr0wlit - Sep 6, 2011 Hi all, i've searched in the forum but i haven't found this so please, don't flame if this is already posted... In this tutorial i will teach you how to check if a website is up or down. Yes, you can use http://www.downforeveryoneorjustme.com/, but if you love to programming, you will be happy to do this! LET'S START! In this example i will not work on the gui of program, that is your work! In your form1, add: 1 Button; 1 Textbox; 1 Label (set Text = ""); You will have a project like this: [img]http://img16.imageshack.us/img16/470/form1p.png[/img] ok, now, double click on the button and add this code: Code Dim str As String = New WebClient().DownloadString(("http://downforeveryoneorjustme.com/" + TextBox1.Text))You will have an error on WebClient, yes because we need to add in the namespace the reference on system.net, so above the Public Class Form1 add: Code imports system.netWHAT HAVE WE DONE? This is a spiegation step by step: Code Dim str As String = New WebClient().DownloadString(("http://downforeveryoneorjustme.com/" + TextBox1.Text))So We have declared a string variable named str. This string contains all of the words that there are on the website http://downforeveryoneorjustme.com/ thetextofthetextbox1. If we go to the site we see that looks like: [img]http://img84.imageshack.us/img84/4782/ssssut.png[/img] Code If str.Contains("It's just you.") ThenIf in the set of words that our program have downloaded there is the phrase "it's just you" (look the image abouve), then the label 1 will say that "the site is UP!"; Code ElseIf str.Contains("It's not just you!") Thenif in the set of words that our program have downloaded there is the phrase "It'not just you!" (This appear when there is a site down), then the label 1 will say that "The site is down!" Code ElseJust a little clarification, if we put in the textbox "sduifdiubi", the label1 will say that it isn't a website! CONCLUSIONS So, this is all, you can customize your program as you want, you can for example change the color of the label based on the results obtained. For example: Code If str.Contains("It's just you.") ThenYou can implement this tool on other your tools for improve the quality of the software! SOURCE OF THE FULL PROGRAM: Code Imports System.NetThis is all, as you can see, this is a very simple program, i hope you like it, if not, please, don't flame!
* - BreastMilk - Sep 6, 2011 um.... Thanks Sure Some People Will Find This Useful! :) * - GayFish - Sep 6, 2011 well it's a good idea i suppose but it's downforeveryone's idea....but still this increases the functionality of it. Thanks for the TUT * - luv. - Sep 6, 2011 or go to isup.me which will take 5 seconds. * - Fake. - Sep 6, 2011 Use isup.me, shorter domain. Input downforeveryoneorjustme.com into your app and it returns "No Website!" Input isup.me and it returns "The site is Down!", when in reality it is up (same site, diff URLs). Just two things for you to consider. * - Gr0wlit - Sep 6, 2011 (Sep 6, 2011 02:07 AM)Fake⢠Wrote: Use isup.me, shorter domain. If i put downforeveryoneorjustme.com into my app it says that it is ONLINE, but yes, if i put isup.me, it says that is offline. And sorry, why i need to use isup.me? when open this app you only need to put for example google.com in the textbox, nothing else! * - Fake. - Sep 6, 2011 (Sep 6, 2011 02:12 AM)Gr0wlit Wrote: If i put downforeveryoneorjustme.com into my app it says that it is ONLINE, but yes, if i put isup.me, it says that is offline. Ah my bad, didn't see it in the title tag. isup.me is shorter than downforeveryoneorjustme.com, that's all. * - IllBeBackSoon - Sep 6, 2011 Just do: Code Dim Client as new WebClient()* - Gr0wlit - Sep 6, 2011 (Sep 6, 2011 05:37 AM)Simran Wrote: Just do: If you do this you must put in the textbox the full URL like Code http://www.google.comIn the program that i've wrote, you can simple put google.com, just a little confort, but the program do the same thing and the code is long equal. Thank you for your post ;) * - Tutsu - Apr 28, 2012 thx bro helped me out :) does any1 know how to do it for an ip as well? * - Coleak - Apr 28, 2012 Seems like there is a lot of code for something you can litterally do in a single line of code. If New System.Net.WebClient().DownloadString(String.Format("http://downforeveryoneorjustme.com/{0}", TextBox1.Text)).Contains("It's just you") Then MsgBox("Online") Else MsgBox("Offline") * - Gr0wlit - Apr 28, 2012 (Apr 28, 2012 02:29 AM)Coleak Wrote: Seems like there is a lot of code for something you can litterally do in a single line of code. lol, why you've read a thread of 1 year ago? :) There are a lot of others threads made before and after this, i'm sure someone else have done it like you say. This was one of my first tutorials:) * - ident - Apr 28, 2012 (Apr 28, 2012 02:29 AM)Coleak Wrote: Seems like there is a lot of code for something you can litterally do in a single line of code. Why on earth would you put all that in a single line? * - Fake. - Apr 28, 2012 (Apr 28, 2012 05:21 AM)ident Wrote: Why on earth would you put all that in a single line? Not to mention reinstantiate the webclient every time the method is called. * - ThrillerCloud - Aug 13, 2012 ok the error i get is when i put google.com in the text box i get the site is down ? never mine it dos it on the website aswell so never mine xD |