Jump to content

Get server online status through php


mikeee324

Recommended Posts

I used the example from the php site, but now it just seems to be saying my servers online when it isn't :S

I mean i can even use any port and it'll say it's online.

Anyone know how i can do this accurately?

$fp = fsockopen("udp://127.0.0.1", 22003, $errno, $errstr); 
if (!$fp)  
{ 
    echo "Offline"; 
} 
else  
{ 
    echo "Online"; 
    fclose($fp); 
     echo "</td>"; 
} 

I read somewhere too that the system might not know that theres nothing there until data is written/read to/from the port, i tried using fread but it didn't bring anything back at all.

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...