Solved

IP ping for online check

Posted on 2006-10-31
6
240 Views
Last Modified: 2012-05-05
Hi,

I would like to know which is the best way (cause I can't find a decent one) to ping an IP in PHP. The system() command doesn't seem to be working on my webserver. Every time i try to ping an 145.84.x.x, no method seems to be working.

The thing I want is like a status checker which displays if the IP is online or offline.

Thank you in advance.
0
Comment
Question by:Destralak
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
6 Comments
 
LVL 14

Expert Comment

by:Aamir Saeed
ID: 17842940
0
 
LVL 4

Expert Comment

by:KellyCraig
ID: 17850520
Did you try an
echo passthrough(ping x.x.x.x);
??

--Kelly
0
 

Author Comment

by:Destralak
ID: 17856424
Fatal error: Call to undefined function: passthrough() in /storage/mijndomein/users/045364/public/sites/uren.destralak.info/test.php on line 2

I'm using PHP Version 4.3.10-16.

Is this a PHP5 function? Because at newyear my host will switch to PHP5 =)

to i_am_aamir: I already checked that out, but the functions mentioned there doesn't seem to work here (read above; the system command doesn't seem to be working)
0
 
LVL 4

Accepted Solution

by:
KellyCraig earned 250 total points
ID: 17859495
Hey.
yes, unfortunately that is a PHP5 function.
It worked like a charm on my php test.

However, with passthrough the page will take as long to load as it takes for the ping to finish and then display in cleartext as it would at a command prompt with no way to format it without parsing it.

--Kelly
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Ajax and PHP 4 49
Unwanted output from my query 5 43
php error 27 61
Integrating blogs between to separate WordPress websites 4 33
Deprecated and Headed for the Dustbin By now, you have probably heard that some PHP features, while convenient, can also cause PHP security problems.  This article discusses one of those, called register_globals.  It is a thing you do not want.  …
Many old projects have bad code, but the budget doesn't exist to rewrite the codebase. You can update this code to be safer by introducing contemporary input validation, sanitation, and safer database queries.
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.

730 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