<?php $ping = exec("ping 127.0.0.1"); print($ping); ?>
Eğer, exec komutu çalışmazsa şu yöntemi de kullanabilirsiniz:
<?php function pingDomain($domain, $port, $timeout, &$message){ $file = fsockopen ($domain, $port, $errno, $errstr, $timeout); $status = 0; $message = $message == null ? $message = array() : $message; if (!$file){ $status = -1; $m = "ping $domain:$port -> status:$status (errno:$errno | errstr:$errstr | timout:$timeout sn)\n"; }else { fclose($file); $status = 1; $m = "ping $domain:$port -> status:$status\n"; } array_push($message, $m); return $status; } pingDomain("8.8.8.8", 55, 3, $m); pingDomain("8.8.8.8", 53, 3, $m); //dns pingDomain("localhost", 1935, 3, $m); //stream pingDomain("localhost", 80, 3, $m); //progressive pingDomain("medianova.com", 80, 3, $m); var_dump($m); ?>
Dear immortals, I need some wow gold inspiration to create.