0

Possible Duplicate:
Ping site and return result in PHP

How do you ping a host/server with PHP to retrieve a (true / false) response. I was reading how to do it with pear Net_ping but I was wondering if there is a curl way to do the same thing?

Community
  • 1
  • 1

1 Answers1

0

Pinging uses the ICMP Protocol.

There's no inbuilt functionality to use that protocol.

You can create raw sockets with PHP to do the transmission manually - but raw socket creating will require root access.

Here's how to do so.

You can also exec the ping utility. (Here for a discussion).

Alternatively you could just see if the server emits a response using another protocol, like HTTP.

Ivo
  • 5,378
  • 2
  • 18
  • 18