Ping desde PHP con el comando shell_exec en IIS 5 y windows XP
| From: | hdl | Date: | Fri, 14 May 2004 01:45:59 +0000 |
| Subject: | Ping desde PHP con el comando shell_exec en IIS 5 y windows XP | ||
| References: | 1 | Groups: | php.general.es |
| Request: | Send a blank email to general-es+get-48516@lists.php.net to get a copy of this message | ||
Sres. listeros
Tengo una consulta , no logro hacer un ping hacia un servidor usando PHP y
el comando SHELL_EXEC
le pongo el código aca a ver si ven algo que se me está pasando
<!-- monitor.php -->
<html>
<head>
<META HTTP-EQUIV="Refresh" CONTENT="60">
</head>
<body>
<h2>Monitoreo de Servers</h2>
<table border=1 cellspacing=3>
<tr>
<?php
$servidores = array (
"server1.com" => "200.215.128.83",
"server2.com" => "200.215.128.241"
);
while (list($site,$ip) = each($servidores)) {
$comando = "ping -n 1 " . $ip;
$salida = shell_exec($comando);
echo
"<td>".$site."<br>".$ip."<br>"."Estado:";
if ( ereg("bytes of",$salida) ) {
echo "<b>online</b></td>";
} else {
echo "<font color=red><b>no responde</b></font></td>";
}
}
?>
</tr>
</table>
</body>
</html>
<!-- fin de programa -->
Desde ya muchas gracias