Answers for "php ping website"

PHP
1

php ping time

<?php
$ip_address = '123.456.789.0'; // IP address you'd like to ping.
exec("ping -c 1 " . $ip_address . " | head -n 2 | tail -n 1 | awk '{print $7}'", $ping_time);
print $ping_time[0]; // First item in array, since exec returns an array.
?>
Posted by: Guest on February-18-2020
0

php ping

exec("ping ".$ip, $output, $status);
// $ip: desired ip address
// $output: result messages from the ping
// $status: result status code from the ping
//		0: success
//		1: no response
//		2: other errors
Posted by: Guest on October-30-2020

Browse Popular Code Answers by Language