Creating a simple Ping Script - need help

Posted on 2004-11-16
Last Modified: 2010-04-06
I am looking to find/learn to create a simple script that can ping servers to see if they are down or not. I have searched online in tons of places and come up with a php script, but I don't have enough permissions to use the exec() commands. Could anyone help me create / point me in the direct of a script in any language that would enable to me ping specific servers that does not require administrative permission? Thanks.

Below is what I have thus far:

echo "Server Status by IP:<br>";

$sites = array();
$sites[] = '';  
$sites[] = '';

foreach($sites as $ip) {
// system() / shell_exec() / exec() - none work
$cmd = shell_exec("ping -c 1 -w 1 $ip");
$ping_results = explode(",",$cmd);
if (eregi ("0 received", $ping_results[1], $out)) { echo "Server is down"; }
if (eregi ("1 received", $ping_results[1], $out)) { echo "Server is up"; }

Question by:nathanmx
    LVL 5

    Accepted Solution

    How about this script?
    LVL 9

    Expert Comment

    This ASP script requires installing a component on the server.  Not sure if that's possible for you since you asked for a non-administrative permission script, but here it is anyway: (scroll all the way to the bottom for ASPPing)

    What is the web server that you are using?  That'll help us give you a more appropriate scripting language.

    LVL 1

    Author Comment

    I looked at that one previously and dismissed it, but since no other one worked, I had to try it. I ended up using only about 10% and doing 90% of my own coding, but the result worked. So I believe thanks is in order. ;)

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Highfive + Dolby Voice = No More Audio Complaints!

    Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

    Preface In the first article: A Better Website Login System ( I introduced the EE Collaborative Login System and its intended purpose. In this article I will discuss some of the design consideratio…
    Introduction Since I wrote the original article about Handling Date and Time in PHP and MySQL ( several years ago, it seemed like now was a good time to updat…
    Viewers will learn about arithmetic and Boolean expressions in Java and the logical operators used to create Boolean expressions. We will cover the symbols used for arithmetic expressions and define each logical operator and how to use them in Boole…
    The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.

    779 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    9 Experts available now in Live!

    Get 1:1 Help Now