Jump to content

a server status checker that works?


andrew121

Recommended Posts

I am making a website and i have this www.22salon.com/test_login/test3/client.php i have a code that looks like this

<?php
$ip = "allexser.dnsalias.net"; //put your ipaddress here
$port= "43594"; //the port number
if (! $sock = @fsockopen($ip, $port, $num, $error, 5)) //Checks the server's status (43594 = port)
{
echo "<font>Offline</font>"; //When server status is offline, output this
}
else
{
echo "<font>Online</font>"; //Else, output this
}
?> 

This code tells whether my RS private server is offline or Online but it doesnt work. it always shows offline. I know how to use this inside an html website so dont tell me that i am doing something wrong in html. All i know is that the script is wrong. all help is appreciated.

Link to comment
https://forums.phpfreaks.com/topic/93908-a-server-status-checker-that-works/
Share on other sites

Have you tried just using the php, removing any HTML?

 

Run it off your webhost and set the following:

 

$ip = "localhost"; //put your ipaddress here
$port= "80"; //the port number

 

It should say online as it does for me..

 

So maybe you do have an error with your html  ;)

Change the offline line to"

 

echo "<font>Offline: $num, $error</font>"; //When server status is offline, output this

 

That should help you understand the error. Your code is fine and works on my machine by changing to my webhost.

 

$ip = "mzproperty.co.uk"; //put your ipaddress here
$port= "80"; //the port number

 

  • 1 month later...

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.