Mr-Moo Posted October 10, 2007 Share Posted October 10, 2007 Hello, This would be my second post here. Gotta say, I love this community. I am creating a small site and I am lost. I am horrid at PHP and currently working to improve it. What I am trying to do is setup a small ping. I was wondering if anyone knew how to setup a ping to ping a website/ip and echo it out to display on a webpage. Any help will be appreciated! Thanks in advance! Link to comment https://forums.phpfreaks.com/topic/72566-solved-echo-ping/ Share on other sites More sharing options...
Warptweet Posted October 10, 2007 Share Posted October 10, 2007 I'm afraid the only pinging I know of it here... http://ca3.php.net/manual/en/function.pg-ping.php Which is pinging a database. I'm positive there is a method you can use to ping a website, but I doubt there is a function to directly do such a thing. Link to comment https://forums.phpfreaks.com/topic/72566-solved-echo-ping/#findComment-365932 Share on other sites More sharing options...
trq Posted October 10, 2007 Share Posted October 10, 2007 <?php function ping($host) { echo "<pre>" . shell_exec("ping -c 1 $host") . "</pre>"; } ping("google.com"); ?> Link to comment https://forums.phpfreaks.com/topic/72566-solved-echo-ping/#findComment-365937 Share on other sites More sharing options...
Barand Posted October 10, 2007 Share Posted October 10, 2007 If you get "Bad option -c", as I did, change "-c" above to "-n" Link to comment https://forums.phpfreaks.com/topic/72566-solved-echo-ping/#findComment-366035 Share on other sites More sharing options...
Mr-Moo Posted October 10, 2007 Author Share Posted October 10, 2007 Thank you all for helping me out! The first code works, second one supplied gives me a blank page. Not sure why. Appreciate your help! Thanks! Link to comment https://forums.phpfreaks.com/topic/72566-solved-echo-ping/#findComment-366386 Share on other sites More sharing options...
hiewps Posted April 2, 2008 Share Posted April 2, 2008 hello there, currently im developing a ping program.. <?php function ping($host) { echo "<pre>" . shell_exec("ping -c 1 $host") . "</pre>"; } ping("google.com"); ?> can i use this to connect to ipv6? thanks u very much~ Link to comment https://forums.phpfreaks.com/topic/72566-solved-echo-ping/#findComment-507216 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.