我能基于traceroute的网络。 我用了shell_exec执行过程,并显示通过浏览器的输出。 我有问题,我第一次打电话上的浏览器页面。 还有就是tracert命令显示的使用。 我试图通过地方躲它的函数里面的脚本。 是的,它的工作原理但像地图中的另一元素,当我开始加载页面不显示。 这是我的PHP代码:
<html>
<head>
<title></title>
<body>
<?
$host = @$_POST['host'];
$trace = @$_POST['trace'];
$self = $_SERVER['PHP_SELF'];
?>
...
<form name="tools" action="<?php $self ?>" method="post">
<p><font size="2">Your IP is <?php $ip ?> </font></p>
<input type="text" name="host" value=""></input>
<input type="submit" name="trace" value="Traceroute!"></input>
</form>
<?php
if ($_POST['submit'])
{
if (($host == 'Enter Host or IP') || ($host == "")) {
echo '<br><br>You must enter a valid Host or IP address.';
exit; }
if(eregi("^[a-z]", $host))
{
$host_name = $host;
$host_ip = gethostbyname($host);
}
else
{
$host_name = gethostbyaddr($host);
$host_ip = $host;
}
}
$host= preg_replace ("[-a-z0-9!#$%&\'*+/=?^_`{|}~]","",$host);
$command = "tracert $host";
$fp = shell_exec("$command 2>&1");
$output .= (htmlentities(trim($fp)));
echo "<pre>$output</pre>";
echo '<br/>';
?>
...
</body>
</html>
和HTML代码(浏览器输出):
'''
<form name="tools" action="" method="post">
<p><font size="2">Your IP is </font></p>
<input type="text" name="host" value=""></input>
<input type="submit" name="trace" value="Traceroute!"></input>
</form>
<pre>Usage: tracert [-d] [-h maximum_hops] [-j host-list] [-w timeout]
[-R] [-S srcaddr] [-4] [-6] target_name
Options:
-d Do not resolve addresses to hostnames.
-h maximum_hops Maximum number of hops to search for target.
-j host-list Loose source route along host-list (IPv4-only).
-w timeout Wait timeout milliseconds for each reply.
-R Trace round-trip path (IPv6-only).
-S srcaddr Source address to use (IPv6-only).
-4 Force using IPv4.
-6 Force using IPv6.</pre><br/> <script type="text/javascript">
var pinImage = new google.maps.MarkerImage ("http://chart.apis.google.com/chart?chst=d_map_xpin_letter_withshadow&chld=pin_star|%E2%80%A2|CC3300|000000|FF9900",
new google.maps.Size (70, 83),
new google.maps.Point (0,0),
new google.maps.Point (10,34));
var pinShadow = new google.maps.MarkerImage ("http://chart.apis.google.com/chart?chst=d_map_pin_shadow",
new google.maps.Size (89, 85),
new google.maps.Point (0, 0),
new google.maps.Point (12, 35));
function initialize() {
var myLatlng = new google.maps.LatLng(38.822591, 150.46875);
var myOptions = {
zoom: 2,
center: myLatlng,
mapTypeId: google.maps.MapTypeId.ROADMAP,
}
var map = new google.maps.Map(document.getElementById("map_canvas"), myOptions);
}
...
所有我需要的是隐藏的traceroute的帮助下使用就像在我的HTML代码。 所以,当我第一次加载页面时,它只是显示的文本框,按钮和地图,而Tracert的这种使用。 我真的尽快需要你的帮助。 太谢谢了。