Posted by Matt F on 05/25/07 16:16
I'm creating simple ping script that prompts a user for various
parameters.
However, I would like each line of the ping displayed as it
is received. Currently, the result isn't displayed until the ping is
finished.
<?php
$ping_ip_addr = $_GET['Host'];
$ping_count = $_GET['Count'];
$ping_size = $_GET['Size'];
$result = explode("\n", `ping -c $ping_count -s $ping_size
$ping_ip_addr`);
print "<pre>";
foreach($result as $val) {
print "$val<br>";
}
print "</pre>";
?>
<font face="verdana" size="2"><form action="<?php echo
$_SERVER['PHP_SELF']; ?>" method="GET">
IP Address: <input type="text" name="Host" />
Count: <input type="text" name="Count" value="5" />
Size: <input type="text" name="Size" value="32" /?
<input type="submit" value="Ping Host" name="Submit" />
</form>
Matt Florido
Navigation:
[Reply to this message]
|