Link to home
Start Free TrialLog in
Avatar of englishman
englishman

asked on

ping simulate thing

OK - here's another to get sorted out.
I have a list of web addresses which I pull one by one from a database.
Is it possible to have a script which checks if each web address is live and alerts me if it isn't?
Avatar of jitganguly
jitganguly

Go to http://www.serverobjects.com/products.htm#free
and download AspPing componet. Store the URLs in a database and execute ping component one by one
Avatar of englishman

ASKER

rather not use components if at all possible...
Well, basically you have to get the output of Ping. If I know correctly Run method of WSH does not return anything. So, you have to think somethign which will return you some value based on a OS commad and thats why I suggested that component
Avatar of Mark Franz
You can run a basic XMLHTTP script on the IP's, if it returns a 200 code then it's good, anything >= 400 is bad.

Looking for code now.
<%
' Start declaring variables.

Dim objXmlHttp
Dim strHTML

' This is the server safe version from MSXML3.
Set objXmlHttp = Server.CreateObject("Microsoft.XMLHTTP")

objXmlHttp.open "GET", "http://180.xxx.xxx.xxx", False

' Send it on it's merry way.
objXmlHttp.send

' Get the request status:
theNumber = objXmlHttp.status
theText = objXmlHttp.statusText

If theNumber = "200" And theText = "OK" Then
   Response.Write "The page is good"
Else
   Response.Write "The page returned a code other than 200 and OK"
End if

Set objXmlHttp = Nothing

%>

Also check out this link, it has more details; http://msdn.microsoft.com/msdn-files/026/001/992/Source%20Files/sample_htm.asp?frame=true

What if it's not a web server, mark?  8)

Why don't you want to use components?
Well he did say "web address's"

Without doing a lot of research on the XML Parser I don't know if it's possible without running a basic batch program.

I know this can be done with a Perl script though using the Net::Ping module...
i mean form "www.name.com"
ASKER CERTIFIED SOLUTION
Avatar of Mark Franz
Mark Franz
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
I didn't read that part, my bad.
mgfranz,
Brilliant, had to add "on error return next" to stop page error when web address dead.
Beautiful, cheers
And just run it through a loop for each address.