以下のスクリプトにポートが応答しない (false) 場合に送信する電子メール機能を追加するにはどうすればよいですか?
<?php
function test_port($host,$port=80,$timeout=6)
{
$fsock = fsockopen($host, $port, $errno, $errstr, $timeout);
if ( ! $fsock )
{
return FALSE;
}
else
{
return TRUE;
}
}
/* check our website http://www.example.com is up and running (port 80) and timeout after 20 seconds */
$ok = test_port('IP/website',80,20);
?>