client page status

T

trpost

I want to create a small app where a client goes to a website, and from
that page they can click a button and see what predefined URL's are
reachable by them. If a URL is unreachable or down, then I want to
return a message to the client with the http error code. I was able to
create a server side application that does this from the servers
perspective using php, but I now want to get the clients perspective.
Any ideas on how to do this, or any reference to some code on where
this has been done.

Thanks!
 
R

RobG

(e-mail address removed) said on 04/04/2006 7:10 AM AEST:
I want to create a small app where a client goes to a website, and from
that page they can click a button and see what predefined URL's are
reachable by them. If a URL is unreachable or down, then I want to
return a message to the client with the http error code. I was able to
create a server side application that does this from the servers
perspective using php, but I now want to get the clients perspective.
Any ideas on how to do this, or any reference to some code on where
this has been done.

From tha group FAQ:

<URL:http://www.jibbering.com/FAQ/#FAQ4_34>

which leads to:

<URL:http://jibbering.com/2002/4/httprequest.html>
 
T

trpost

Thanks! Here is how I implemented it for future reference...

<html>
<head>
<script type="text/javascript">
var xmlhttp

function loadXMLDoc(url)
{
// code for Mozilla, etc.
if (window.XMLHttpRequest)
{
xmlhttp=new XMLHttpRequest()
xmlhttp.onreadystatechange=state_Change
xmlhttp.open("GET",url,true)
xmlhttp.send(null)
}
// code for IE
else if (window.ActiveXObject)
{
xmlhttp=new ActiveXObject("Microsoft.XMLHTTP")
if (xmlhttp)
{
xmlhttp.onreadystatechange=state_Change
xmlhttp.open("GET",url,true)
document.getElementById('A1').innerHTML=url
xmlhttp.send()
}
}
}

function state_Change()
{
// if xmlhttp shows "loaded"
if (xmlhttp.readyState==4)
{
clearPreloadPage();
document.getElementById('A2').innerHTML=xmlhttp.status
document.getElementById('A3').innerHTML=xmlhttp.statusText
}
}

</script>
</head>

<body onload="loadXMLDoc('http://www.google.com:8080');">
<p>

<b>URL:</b>
<span id="A1"></span>

<br><b>status:</b>
<span id="A2"></span>

<br><b>status text:</b>
<span id="A3"></span>
</p>

</body>
</html>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,008
Latest member
HaroldDark

Latest Threads

Top