^!!~ Check if a service/machine is alive ~!!^
Check and see if a service is up or down on a certain machine. Useful for alot of things, say you have MSN Messenger or AIM, you can have a script check YOUR IP address and the MSN or AIM port number and then let the users at your website know if your online or not! Can also be useful if you use alot of file mirrors for your website and want to check if there up or down. Infinite amount of uses! Really fun, simple, easy to use, and useful for many things. Well commented.
AI
สรุปโดย AI: This codebase represents a historical implementation of the logic described in the metadata. Our preservation engine analyzes the structure to provide context for modern developers.
ซอร์สโค้ด
<?php
error_reporting(0); //** Turn error reporting off so we don't get the unneeded warning message if we fail to connect, we will handle that our selfs
$address = "127.0.0.1"; //** Address of the machine
$service = 80; //** Service or Port number, in this case 80 for the HTTPD daemon... say we want to have a page to check if our webserver is up
//** fsockopen returns a boolean value upon execution, depending if it fails(returns FALSE or NULL) or not(returns TRUE)
if(fsockopen($address, $service)) //** If we can connect...
{
//** Address is up, do what you want here
echo "$address:$service is up!";
}
else //** We can't connect!
{
//** Address is NOT up, do what you want here
echo "$address:$service is NOT up!";
}
?>
ความคิดเห็นดั้งเดิม (3)
กู้คืนจาก Wayback Machine