Evening all.
I have a <DIV> with a bit of PHP code in it that tries to connect to certain ports on various servers. If it connects it puts a tick in the box, if it fails a red cross - basic monitoring if you like.
Now, is there an easy way that I can refresh the PHP code in the <DIV> say every 5 minutes.
The PHP code at the mo is (with server name / IP eddited!):
So all I want to do really is refresh the table row every 5 minutes without refreshing the whole page.
Any advice appreciated before I get the meta refresh tag going!
M.
I have a <DIV> with a bit of PHP code in it that tries to connect to certain ports on various servers. If it connects it puts a tick in the box, if it fails a red cross - basic monitoring if you like.
Now, is there an easy way that I can refresh the PHP code in the <DIV> say every 5 minutes.
The PHP code at the mo is (with server name / IP eddited!):
PHP:
Table row:
<tr>
<td>hostname.0hai.com</td>
<td align="center"><?php getStatus("xx.xx.xx.xx", 80); ?></td>
<td align="center"><?php getStatus("xx.xx.xx.xx", 21); ?></td>
<td align="center"><?php getStatus("xx.xx.xx.xx", 110); ?></td>
<td align="center"><?php getStatus("xx.xx.xx.xx", 25); ?></td>
<td align="center"><?php getStatus("xx.xx.xx.xx", 22); ?></td>
<td align="center"><?php getStatus("xx.xx.xx.xx", 1080); ?></td>
</tr>
The getStatus function:
function getStatus($name, $port)
{
$fp = fsockopen($name, $port, $errno, $errstr, 3);
if (!$fp)
{
$status = "img/cross.gif";
}
else
{
$status = "img/tick.gif";
}
print "<img src='".$status."'>";
}
So all I want to do really is refresh the table row every 5 minutes without refreshing the whole page.
Any advice appreciated before I get the meta refresh tag going!
M.