We help IT Professionals succeed at work.
Get Started

Pinging tunneled IPs always shows as up with PHP?

Last Modified: 2012-05-12
On a linux server, the network-scripts has something like this, for example:


And those IPs are pretty much tunneled to the server. However, when I do a simple check to see if the IP is up and pointed to the proper server with PHP:

function check_content($url)
      global $timeout;
      $ch = curl_init();

      curl_setopt ($ch, CURLOPT_URL, $url);
      curl_setopt ($ch, CURLOPT_HEADER, 0);
      curl_setopt ($ch, CURLOPT_TIMEOUT, 20);
      curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);

      $string = curl_exec($ch);
      curl_close ($ch);

      $pos = strpos($string, "Username:");
      if ($pos === false) {
            return 0;
      $pos = strpos($string, "Password:");
      if ($pos === false) {
            return 0;
      return 1;

This always shows as UP, even if the IPs are down. So if I use on that server that has them linked, it displays as UP and is getting the proper page, almost as if it gave that 'ip' local access lke would.

I'm not sure how to solve this, but I need to make sure the IP is UP and it's going to the right page (with a simple check to see if username/pass is on that page.) Any suggestions?
Watch Question
This problem has been solved!
Unlock 2 Answers and 12 Comments.
See Answers
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE