Hi everyone, i'm trying to monitoring some servers on port 25, the problem is that when i run the script i obtain this message :" Supplied argument is not a valid File-Handle resource in \apache\htdocs\monitoring.php on line 36 Bad file descriptor (9)".
Dns is working good,and the same script work good without array but only one server target.
I'm new to php, what i'm missing, what's wrong?
thank's in advance and sorry for my english,
(i know it's not so good!)
<head>
<META HTTP-EQUIV="refresh" CONTENT="300; URL=HTTP://localhost/monitoring.php">
<META HTTP-EQUIV="expires" CONTENT="0">
<META HTTP-EQUIV="pragma" CONTENT="no-cache">
</head>
<?
$port="25"
$target= array (
"smtp" => array ("1a"=>"smtp1a.csi",
"1b"=>"smtp1b.csi",
"1c"=>"smtp1c.csi",
"2a"=>"smtp2a.csi",
"2b"=>"smtp2b.csi",
"2c"=>"smtp2c.csi",
"3a"=>"smtp3a.csi",
"3b"=>"smtp3b.csi",
"3c"=>"smtp3c.csi")
);
foreach($target["smtp"] as $goal){
$fp = fsockopen("$goal", $port, $errno, $errstr);
if (!$fp) {
echo "$errstr ($errno)<br>\n";
} else {echo "<title>Connection test</title><body bgcolor=orange><center><font color=blu face=arial >Connection with";
echo " "$target["smtp"]" ";
echo "on port ";
echo " "$port["smtp"]" ";
echo "is working </font></center></body>";}
fclose ($fp);
}
?>