Hi,
I am new to PHP.
Can anyone has idea about how to write code to ping the web/application server from PHP?.
If server is down then we should able to send an email.
I want this utility for web sites tracking.
Please help me suggest me any code.
Thanks,
Nil.
How to ping server from PHP ?
Moderator: General Moderators
You can let php perform a http request on that server.
E.g. for php versions >= 5.1.0
E.g. for php versions >= 5.1.0
Code: Select all
stream_context_get_default(array('http' =>array('method' => 'HEAD')));
print_r(get_headers('http://serv.er/'));