Re: Cheap Ping
| From: | tedd | Date: | Fri, 13 Apr 2007 15:56:37 +0000 |
| Subject: | Re: Cheap Ping | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-252879@lists.php.net to get a copy of this message | ||
At 11:16 PM -0600 4/12/07, ccspencer@softhome.net wrote:
Hello, I am trying to find a simple way to test to see if a web site is up or not. I tried using $file = file_get_contents("http://www.example.com/page.html"); but when the site is down it takes too long and seems to time out terminating the script rather than returning a false I can test. Is there some way I can set a shorter limit? Or something? Any other suggestions? Best, CraigTry: if ($unix) { system ("ping -c$count -w$count $host"); system("killall ping"); } else { system("ping -n $count $host"); } Cheers, tedd -- ------- http://sperling.com http://ancientstones.com http://earthstones.com