PHP script to check server status online/offline

i wrote a simple php script to check whether the website or Ip address is online or offline. All you have to do is specify a website url or ip address and the script will return with ONLINE or OFFLINE. I used php fsockopen() to accomplish this.

[code lang=”php”]
/* Usage:
$status = GetServerStatus(‘http://domain.com’,80)
or
$status = GetServerStatus(‘IPAddress’,80)
*/


[/code]

If you want to ping a server to check connectivity, you can use php ping scripts.