Если чисто из браузера, то ответ будет отдавать с задержкой. Чтобы онлайн, как в командной строке, то погуглите лучше на тему Looking Glass, но там железо нужно.
<?php
/*
* credits to:
* c00kiemon5ter for various suggestions
* HdkiLLeR(vpk) for security tips
*/
?>
<html xmlns="http://www.w3.org/1999/xhtml" dir="" lang="ru" xml:lang="ru">
<head>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=UTF-8">
<link rel="icon" type="image/png" href="favicon.png" />
<link rel="shortcut icon" href="favicon.ico" />
<link rel="stylesheet" type="text/css" href="./css/style.css">
<title>Network Tools</title>
</head>
<body>
<div class="wrap">
<h1>LDS Network Tools</h1>
<center>
<form name="input" action="index.php" method="get">
<select name="servise">
<option value="ping">ping </option>
<option value="traceroute">traceroute</option>
<option value="nslookup">nslookup</option>
</select>
IP:
<input type="text" name="address" />
<input type="submit" name ="submit" value="Отправить" />
</form></center><br />
<?php
if(isset($_GET['submit']))
{
// use of escapeshellcmd - must be enabled
// http://php.net/manual/en/function.escapeshellcmd.php
// escapes #&;`|*?~<>^()[]{}$\, \x0A and \xFF. ' and "
// are escaped only if they are not paired.
$servise = trim($_GET['servise']);
$address = trim($_GET['address']);
if(
(strpos($address,'/')>0)
|| (strpos($address,'/')===0) )
{
echo "Не шути так!";
exit();
}
if($servise=="ping")
{
exec("ping '".escapeshellcmd($address)."' -c 4",$results); exec("ping '".escapeshellcmd($address)."' -c 4 -s 14500",$results2);
}
if($servise=="traceroute")
{
exec("traceroute '".escapeshellcmd($address)."'",$results3);
}
if($servise=="nslookup")
{
exec("nslookup '".escapeshellcmd($address)."'",$results3);
}
foreach($results3 as $result3)
{
echo $result3;
echo "<br />";
}
if($results == null)
{
echo "<center><br />¯\_(ツ)_/¯</center>";
}
echo "<br />";
}
?>
<div class="col1"><h4>Обычным пингом</h4>
<div data-layzr="media/source" class="block1">
<?php
foreach($results as $result){
echo $result;
echo "<br />";
}
?>
</div></div>
<div class="col1"><h4>Под нагрузкой</h4>
<div data-layzr="media/source" class="block1">
<?php
foreach($results2 as $result2){
echo $result2;
echo "<br />";
}
?>
</div></div>
</div>
</body>
</html>
body { background: url(../img/bg.jpg) no-repeat center top; background-color: #024162; font-family: Arial, Helvetica, sans-serif;}
.wrap { width:1000px; margin: 35 auto; background:#fff; padding: 20px 20px 20px 20px;}
.col1 { width:49%; float:left; margin-left: 7px; background:#CCC; padding-top: 10px;}
.block1 { margin: 5px 5px 5px 5px; width: 94%; padding: 8px; border:1px solid #999; background:#FFF;}