Check out this function and read all the user comments:
Here's a very simple demonstration of php code:
<?php if (fsockopen('www.yourserver.com', 80)){
echo('The server in online');
} else{
echo('The server in offline'); } ?>
The first parameter is the IP address of the server you want to check (in this case, www.yourserver.com, it could also be something like 111.222.333.444). The 80 is the port number (for HTTP), which can sometimes be different (21 for FTP etc.).
No comments:
Post a Comment