Is there a way to check if a host is up?

Posted by Rob on Stack Overflow See other posts from Stack Overflow or by Rob
Published on 2011-01-13T22:46:17Z Indexed on 2011/01/13 22:53 UTC
Read the original article Hit count: 145

Filed under:
|
|

I'm trying to do this in PHP. I need to check if a specified host is "up"

I thought of pinging the specified host (though I'm not sure how I would, since that would require root. --help here?)

I also though of using fsockopen() to try to connect on a specified port, but that would fail too, if the host wasn't listening for connections on that port.

Additionally, some hosts block ping requests, so how might I get around this? This part isn't a necessity, though, so don't worry about this too much. I realize this one might get tricky.

© Stack Overflow or respective owner

Related posts about php

Related posts about ping