Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- function ping($host)
- {
- exec(sprintf('ping -c 1 -W 5 %s', escapeshellarg($host)), $res, $rval);
- return $rval === 0;
- }
- // random host ip example
- $host = '192.168.0.2';
- $online = ping($host);
- // if site is online, send them to the site.
- if ($online) { echo "online"; } else { echo "offiline"; } ;
- function ping($host)
- {
- exec(sprintf('ping -c 1 -W 5 %s', escapeshellarg($host)), $res, $rval);
- return $rval === 0;
- }
- // random host ip example
- $host = '192.168.0.1';
- $online = ping($host);
- // if site is online, send them to the site.
- if ($online) { echo "online"; } else { echo "offiline"; } ;
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement