Jump to content

ping help


stuckwithcode

Recommended Posts

is this the best way to check if a server is live? 

 

<?php

 

$host = "www.google.com";

$fp = fsockopen($host, 80, $errno, $errstr, 10);

 

if($fp)

{

echo "yes it is";

fclose($fp);

}

else

{

echo "no it is not";

}

 

?>

 

But if you type in a false server eg www.googddfsdfsd.com it returns an error how can i get it to return false and why doesn't it.

Link to comment
https://forums.phpfreaks.com/topic/215117-ping-help/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.