Re: Cheap Ping

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, April 13, 2007 12:16 am, ccspencer@xxxxxxxxxxxx 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?

The timeout for that is set in php.ini, and you can reset it right
before you do file_get_contents to something much more reasonable.

You might want to log the failure, and only hit a panic button if it
fails N times in X minutes or something, but it's quite do-able.


-- 
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some indie artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux