Jump to content

Archived

This topic is now archived and is closed to further replies.

stephenmelody

Ping a remote device to show whether it is on or offline

Recommended Posts

Hello All!

I am trying to develop an application that will ping a IP address or computer name from the database to return an online or offline image on the webpage depending on the ping results. ie if the ping returns the packet the page displays online, and if it doenst it displays offline.

If anyone has any idea on how to do this then I would be extremely grateful.

Cheers,

Steve.

Share this post


Link to post
Share on other sites
You can use system commands to do this on either Windows or *NIX with something like this:
[code]<?php
exec("ping 192.168.1.1",$out);
echo "<pre>"; print_r($out); echo "</pre>";
?>[/code]

Share this post


Link to post
Share on other sites
I copied and pasted the code into a lovely new php page.

and it went all wrong and gave me this:

Warning: exec(): Unable to fork [ping 127.0.0.1] in C:\Inetpub\apps site\pinger\ping3.php on line 2

any clues?

Ta,

Steve

Share this post


Link to post
Share on other sites
Is php running in safe mode?

Share this post


Link to post
Share on other sites
If it's a MySQL Server/Database you can use mysql_ping (or similar for other DB flavors).
http://us2.php.net/manual/en/function.mysql-ping.php

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.