Solved

IP ping for online check

Posted on 2006-10-31
6
238 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
  • 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

NAS Cloud Backup Strategies

This article explains backup scenarios when using network storage. We review the so-called “3-2-1 strategy” and summarize the methods you can use to send NAS data to the cloud

Question has a verified solution.

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

Suggested Solutions

This article discusses four methods for overlaying images in a container on a web page
This article discusses how to create an extensible mechanism for linked drop downs.
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
The viewer will learn how to count occurrences of each item in an array.

810 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