<?phpClass ping{static function site($ip,$text){$cmd = shell_exec("ping $ip");$ping_results = explode(",",$cmd);for($i=0;$i<count($ping_results)+1;$i++){if(preg_match("/time=(.*)/si", @$ping_results[$i], $pingtime)){$pingtime = explode("ms",$pingtime[$i]);$pingtime = explode("time=",$pingtime[0]);$text = str_replace("{site}",$ip,$text);$text = str_replace("{time}",$pingtime[1],$text);print("$text");}else{echo implode("<br>",$ping_results);}die();}}}ping::site("www.google.com", "Ping yaniti {site}: {time}");?>
Çıktısı
Ping yaniti www.google.com: 104 Pinging www.google.com [172.217.169.100] with 32 bytes of data: Reply from 172.217.169.100: bytes=32 time=104ms TTL=245 Reply from 172.217.169.100: bytes=32 time=117ms TTL=245 Reply from 172.217.169.100: bytes=32 time=123ms TTL=245 Reply from 172.217.169.100: bytes=32 time=82ms TTL=245 Ping statistics for 172.217.169.100: Packets: Sent = 4Received = 4Lost = 0 (0% loss)Approximate round trip times in milli-seconds: Minimum = 82msMaximum = 123msAverage = 106ms Pinging www.google.com [172.217.169.100] with 32 bytes of data: Reply from 172.217.169.100: bytes=32 time=104ms TTL=245 Reply from 172.217.169.100: bytes=32 time=117ms TTL=245 Reply from 172.217.169.100: bytes=32 time=123ms TTL=245 Reply from 172.217.169.100: bytes=32 time=82ms TTL=245 Ping statistics for 172.217.169.100: Packets: Sent = 4Received = 4Lost = 0 (0% loss)Approximate round trip times in milli-seconds: Minimum = 82msMaximum = 123msAverage = 106ms Pinging www.google.com [172.217.169.100] with 32 bytes of data: Reply from 172.217.169.100: bytes=32 time=104ms TTL=245 Reply from 172.217.169.100: bytes=32 time=117ms TTL=245 Reply from 172.217.169.100: bytes=32 time=123ms TTL=245 Reply from 172.217.169.100: bytes=32 time=82ms TTL=245 Ping statistics for 172.217.169.100: Packets: Sent = 4Received = 4Lost = 0 (0% loss)Approximate round trip times in milli-seconds: Minimum = 82msMaximum = 123msAverage = 106ms Pinging www.google.com [172.217.169.100] with 32 bytes of data: Reply from 172.217.169.100: bytes=32 time=104ms TTL=245 Reply from 172.217.169.100: bytes=32 time=117ms TTL=245 Reply from 172.217.169.100: bytes=32 time=123ms TTL=245 Reply from 172.217.169.100: bytes=32 time=82ms TTL=245 Ping statistics for 172.217.169.100: Packets: Sent = 4Received = 4Lost = 0 (0% loss)Approximate round trip times in milli-seconds: Minimum = 82msMaximum = 123msAverage = 106ms Pinging www.google.com [172.217.169.100] with 32 bytes of data: Reply from 172.217.169.100: bytes=32 time=104ms TTL=245 Reply from 172.217.169.100: bytes=32 time=117ms TTL=245 Reply from 172.217.169.100: bytes=32 time=123ms TTL=245 Reply from 172.217.169.100: bytes=32 time=82ms TTL=245 Ping statistics for 172.217.169.100: Packets: Sent = 4Received = 4Lost = 0 (0% loss)Approximate round trip times in milli-seconds: Minimum = 82msMaximum = 123msAverage = 106ms Pinging www.google.com [172.217.169.100] with 32 bytes of data: Reply from 172.217.169.100: bytes=32 time=104ms TTL=245 Reply from 172.217.169.100: bytes=32 time=117ms TTL=245 Reply from 172.217.169.100: bytes=32 time=123ms TTL=245 Reply from 172.217.169.100: bytes=32 time=82ms TTL=245 Ping statistics for 172.217.169.100: Packets: Sent = 4Received = 4Lost = 0 (0% loss)Approximate round trip times in milli-seconds: Minimum = 82msMaximum = 123msAverage = 106ms