Solved

IP ping for online check

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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

This article will explain how to display the first page of your Microsoft Word documents (e.g. .doc, .docx, etc...) as images in a web page programatically. I have scoured the web on a way to do this unsuccessfully. The goal is to produce something …
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.  …
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

762 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

23 Experts available now in Live!

Get 1:1 Help Now