Check out the program execution functions on PHP.net.
I built a little tool that will ping a host, with a webform as a front for entering the url/ip address, and then a page that displays the results. It uses the exec() function to call ping.exe. Here's the code for it, for you to use as an example:
exec("ping $ip -n $number", $output);
$count = count($output);
$stats_start = $count - 4;
echo("<table align=\"center\">");
for($i = 0; $i <= $count; $i++){
echo("<tr>\n\t<td>");
if ($i < $stats_start && $i != 1) { echo ("<font class=\"1\">"); }
elseif ($i == 1) { echo ("<font class=\"3\">"); }
elseif ($i >= $stats_start) { echo ("</font><font class=\"2\">"); }
if ($output[$i] == "") { $output[$i] = " "; }
echo ("$output[$i]</font></td>\n</tr>");
}
echo ("<tr><td> </td></tr><tr><td><font class=\"3\">Click <a href=\"index.php\">here </a>to do it again</font></td></tr>");
echo("</table>");
The vars $ip and $number are passed to the script through the form.
Hope this helps.