Gordon wrote:if ($handle = fsockopen ('localhost', 80, $errnum, $errmsg, 1))On Oct 22, 5:34 pm, Shadlan <shad...@arjoc.comwrote:Hi.I need to know if a service is running on my server. Is there any PHP
instruction that I can use to do this?If the service accepts incoming connections then you might be able to
use curl to try and connect to the machine on the port associated with
the service in question. *If the service doesn't accept connections
then some other approach would be needed. *I've not looked closely at
the responses already made but at first glance they look like they
could work.
Seems like fsockopen() would probably be sufficient.
--
Curtis
{
echo ('A web server is running on this system<br>');
fclose ($handle);
}
else
{
echo ($errnum . ' ' . $errmsg . '<br>');
echo ('A web server is not running on this system<br>');
}
if ($handle = fsockopen ('localhost', 443, $errnum, $errmsg, 1))
{
echo ('A secure web server is running on this system<br>');
fclose ($handle);
}
else
{
echo ($errnum . ' ' . $errmsg . '<br>');
echo ('A secure web server is not running on this system<br>');
}
A web server is running on this system
Warning: fsockopen() [function.fsockopen]: unable to connect to
localhost:443 (A connection attempt failed because the connected party
did not properly respond after a period of time, or established
connection failed because connected host has failed to respond. ) in D:
\Gordon McVey\apachedev\cmsNew\index.php on line 18
10060 A connection attempt failed because the connected party did not
properly respond after a period of time, or established connection
failed because connected host has failed to respond.
A secure web server is not running on this system