Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

PHP Ping

Status
Not open for further replies.

Brianfree

Programmer
Feb 6, 2008
220
GB
Hi, please can any one help me with a php page that will ping multiple devices (servers, routers, etc..) and display if they are online or offline? Then refresh every minute? Would need to keep the current status in a session so when the page reloads it holds the last value before running the code again?

Many thanks,

Brian
 
What do you have so far?

We aren't going to write the code out for you. We can help you if you get stuck somewhere.

For starters, you need to tell us what platform this is running on. As the ping command is slightly different between windows and linux.

Also refreshing every minute seems like too much, specially if you are sequentially pinging many things. As it may take time to ping, and if there is no answer or any type of delay you're likely to refresh before all pings complete. Also pinging constantly causes traffic and may impact your network's performance. I'd say at least 15 minutes between pings.

You'll want to have an array with the IPs to ping, so you can step through it and ping.

Other than that, it should be rather straight forward using the system or passthru functions.




----------------------------------
Phil AKA Vacunita
----------------------------------
Ignorance is not necessarily Bliss, case in point:
Unknown has caused an Unknown Error on Unknown and must be shutdown to prevent damage to Unknown.

Web & Tech
 
I would assume that because this question is being asked in the PHP forum that the "ping page" is to be accessible from a website. If so, vacunita raises some good points regarding the local system and how a ping is handled. However, personally, if the local machine is and will always be a Windows box, I would use an HTA with VBS to accomplish this.

-Geates

"I do not offer answers, only considerations."
- Geates's Disclaimer

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top