CodeIgniter Forums
butuh bantuan - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: General (https://forum.codeigniter.com/forumdisplay.php?fid=1)
+--- Forum: Regional User Groups (https://forum.codeigniter.com/forumdisplay.php?fid=25)
+--- Thread: butuh bantuan (/showthread.php?tid=66975)



butuh bantuan - fy25 - 12-26-2016

hallo slaam kenal Big Grin  member bru dr jember. Mau tnya2 nih gan , ane kan kerja d slah stu perusahaan swasta di kota ane, nah d prshaan ane ad server (merk di sensor Big Grin ) naah prmslahan ane kira2 kalo buat script php (utamnya CI) semacam aplikasi gitu untk mengecek server itu mati / hidup gitu bisa kagak yaa ??
maksih Rolleyes Angel


RE: butuh bantuan - uyak - 01-05-2017

Coba pakai fasilitas ping server...


Check this script:

<?php
function ping($host) {
exec(sprintf('ping -c 1 -W 5 %s', escapeshellarg($host)), $res, $rval);
return $rval === 0;
}

$hosts_to_ping = array('10.140.206.123', '127.0.0.1');
?>

<ul>
<?php foreach ($hosts_to_ping as $host): ?>
<li>
<?php echo $host; ?>
<?php $up = ping($host); ?>
(<img src="<?php echo $up ? 'on' : 'off'; ?>"
alt="<?php echo $up ? 'up' : 'down'; ?>">)
</li>
<?php endforeach; ?>
</ul>

source: http://www.dynamicdrive.com/forums/showthread.php?37370-make-ping-with-PHP