1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

make ping with PHP

Discussion in 'PHP' started by guif, Oct 8, 2008.

  1. guif

    guif New Member

    Joined:
    Jul 25, 2008
    Messages:
    30
    Likes Received:
    0
    Trophy Points:
    0
    I would like to make a simple monitoring. I make this:

    Code:
    <?php
    $ip = $_SERVER['127.0.0.1'];
    exec("ping -n 4 $ip 2>&1", $output, $retval);
    if ($retval != 0) { 
    echo "no!"; 
    } 
    else 
    { 
    echo "yes!"; }
    ?>
    I use my internal IP: 127.0.0.1.
    The result is: NO!

    why???
     
  2. asha

    asha New Member

    Joined:
    Nov 9, 2006
    Messages:
    44
    Likes Received:
    2
    Trophy Points:
    0
    Occupation:
    Homemaker
    Location:
    Kolkata
    Home Page:
    What platform are you running the script on?
     

Share This Page