
July 30th, 2006
04:58 AM
the eXtreme-o dEsign-o!
Status: Offline!
Check if an IP/Site is online?
I used to have a script that would check if a site was online or "Up", but I cant find it anymore,
Basicly what i need help with is pinging/connecting to a site and printing "Offline" or "Online" if it can connect to the site..
Can anyone help?

July 31st, 2006
01:24 AM
funny and cheeky
Status: Offline!
if your host hasn't blocked the system command why cant u just use that to execute a ping on the server.
system('ping ' . $ping_count . ' ' . $ping_ip_addr); // Ping IP address.
I got this from a website. I didn't think of that but i knew that existed
it can also be a url. The dns will convert it to an ip.
Last edited by schoi, July 31st, 2006 01:25 AM (Edited 1 times)

July 31st, 2006
12:40 PM
Neverside Newbie
Status: Offline!
Not ALL sites will respond to ICMP pings. One example would be CNN.com. A real simple way to check a site out on the standard port (port 80) would be to do
<?php
if ($a = fsockopen('cnn.com', 80))
{
echo 'Site appears to be working!';
fclose($a);
}
?>
Just a suggestion though, if you're planning to have it open to everyone, having the abilty to check a site via opening/closing a socket upon request, not a good idea because it's a big security hole. I think... Correct me if I am wrong, though.

August 2nd, 2006
02:55 PM
the eXtreme-o dEsign-o!
Status: Offline!
Originally posted by Xolt:
Not ALL sites will respond to ICMP pings. One example would be CNN.com. A real simple way to check a site out on the standard port (port 80) would be to do
<?php
if ($a = fsockopen('cnn.com', 80))
{
echo 'Site appears to be working!';
fclose($a);
}
?>
Just a suggestion though, if you're planning to have it open to everyone, having the abilty to check a site via opening/closing a socket upon request, not a good idea because it's a big security hole. I think... Correct me if I am wrong, though.
exacly what i was looking for, thanks!