PHP Ping Script
Posted: Mon Mar 01, 2004 7:07 am
Hi folks. I've managed to piece together a php ping script that i THINK should work, but all urls that i ping, it says they are all down.
Here is the code, do you have any idea what's going wrong with it?
I can't link to a result page, because its my local test server, but check at the bottom for a dump of what it tells me.
here is what it outputs...
hammerslane.com is up, and obviously, so is phpbuilder.com, yet it says they're both down.
anyone have an idea?
many thanks
Here is the code, do you have any idea what's going wrong with it?
I can't link to a result page, because its my local test server, but check at the bottom for a dump of what it tells me.
Code: Select all
<?php
//URL ARRAY
$links = array ("www.hammerslane.com","www.phpbuilder.com","www.linkynoworkyaaaaaaaaaa.com");
function chkuri($link)
{
$churl = @fopen("http://".$link,'r');
if (!$churl) {
return false;
}else{
return true;
}
}
foreach($links AS $link)
{
if(!chkuri($link))
{
print"$link is down<br><br>";
}
else
{
print"$link is up<br><br>";
}
}
?>Code: Select all
www.hammerslane.com is down
їurl]www.phpbuilder.comї/url] is down
їurl]www.linkynoworkyaaaaaaaaaa.comї/url] is downanyone have an idea?
many thanks