Page 1 of 1

Checking online status

Posted: Fri Dec 15, 2006 3:12 pm
by tarja311
Hey all.

I have a page that displays the online status of a computer on the internet using a basic :

Code: Select all

$status = @fsockopen($ip_address, $port, $errno, $errstr, 2);
Many users rely on this script to determine if that computer is online or not. Unfortunately they always have to refresh the page to see any status changes. I understand ( or at least i think i understand ) that i can fix this using Ajax. That way they don't have to refresh the page because it will do it for them in real-time.

Can someone point me in the right direction here, as i am not exactly savvy in javascript. I have browsed around the internet for scripts that do this but came up empty ( all of them were for messenger services. )

Or perhaps show me some example code.

Thanks a lot

-- tarja

Posted: Fri Dec 15, 2006 3:34 pm
by Cody Mays
You can easily accomplish this with AJAX, even easier using prototype.js
Here are a few links to tutorials on prototype, some containing information on the auto updater.

http://particletree.com/features/quick- ... prototype/
http://www.sergiopereira.com/articles/p ... calUpdater

Posted: Fri Dec 15, 2006 5:45 pm
by tarja311
Thanks for replying.

I know this may sound silly but i still do not know how to incorporate the Ajax.Updater into my page. :oops: I've never tried working with javascript before so i don't really know how to call / use the function i need. I included the prototype.js but i do not know how to talk to it.

Posted: Fri Dec 15, 2006 6:10 pm
by Cody Mays
I would google for some javascript tutorials. If you know the basics, it's fairly easy to use prototype. :)