andrew121 Posted March 1, 2008 Share Posted March 1, 2008 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 More sharing options...
nano Posted March 1, 2008 Share Posted March 1, 2008 I pasted that exact snipet and ran it on my localhost (whilst changing the port) and it stated online.. If I made up another port, it would state offline. Which means you must have an error on your server end. Good luck Link to comment https://forums.phpfreaks.com/topic/93908-a-server-status-checker-that-works/#findComment-481214 Share on other sites More sharing options...
andrew121 Posted March 1, 2008 Author Share Posted March 1, 2008 what do you mean? Link to comment https://forums.phpfreaks.com/topic/93908-a-server-status-checker-that-works/#findComment-481216 Share on other sites More sharing options...
nano Posted March 1, 2008 Share Posted March 1, 2008 Well what I mean is there is nothing wrong with the script. That leaves an error to the server you are trying to check.. maybe the port is not open etc? Link to comment https://forums.phpfreaks.com/topic/93908-a-server-status-checker-that-works/#findComment-481217 Share on other sites More sharing options...
andrew121 Posted March 1, 2008 Author Share Posted March 1, 2008 i do have an open port ive tried it on many servers. Link to comment https://forums.phpfreaks.com/topic/93908-a-server-status-checker-that-works/#findComment-481218 Share on other sites More sharing options...
nano Posted March 1, 2008 Share Posted March 1, 2008 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 Link to comment https://forums.phpfreaks.com/topic/93908-a-server-status-checker-that-works/#findComment-481219 Share on other sites More sharing options...
andrew121 Posted March 1, 2008 Author Share Posted March 1, 2008 es iv tried it without html www.22salon.com/test_login/test3/test.php Link to comment https://forums.phpfreaks.com/topic/93908-a-server-status-checker-that-works/#findComment-481221 Share on other sites More sharing options...
andrew121 Posted March 1, 2008 Author Share Posted March 1, 2008 oh your right it says online. mmmh, when i change it to my port which is 43594 it says offline. i put it localhost. Link to comment https://forums.phpfreaks.com/topic/93908-a-server-status-checker-that-works/#findComment-481222 Share on other sites More sharing options...
nano Posted March 1, 2008 Share Posted March 1, 2008 so you will need to double check that port good luck. Link to comment https://forums.phpfreaks.com/topic/93908-a-server-status-checker-that-works/#findComment-481223 Share on other sites More sharing options...
Mario F. Posted March 1, 2008 Share Posted March 1, 2008 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 Link to comment https://forums.phpfreaks.com/topic/93908-a-server-status-checker-that-works/#findComment-481224 Share on other sites More sharing options...
andrew121 Posted March 1, 2008 Author Share Posted March 1, 2008 kk thanks i am trying to change port to 33 now and see if its the 4 digits that kill it. Link to comment https://forums.phpfreaks.com/topic/93908-a-server-status-checker-that-works/#findComment-481225 Share on other sites More sharing options...
andrew121 Posted March 1, 2008 Author Share Posted March 1, 2008 well apperantly it still doesnt work... it says Offline: 111, Connection refused Link to comment https://forums.phpfreaks.com/topic/93908-a-server-status-checker-that-works/#findComment-481229 Share on other sites More sharing options...
Mario F. Posted March 1, 2008 Share Posted March 1, 2008 If you are still not convinced, do a port scan on the target machine and use the script on an opened port. Link to comment https://forums.phpfreaks.com/topic/93908-a-server-status-checker-that-works/#findComment-481231 Share on other sites More sharing options...
andrew121 Posted March 1, 2008 Author Share Posted March 1, 2008 how do i do this? Link to comment https://forums.phpfreaks.com/topic/93908-a-server-status-checker-that-works/#findComment-481236 Share on other sites More sharing options...
trq Posted March 2, 2008 Share Posted March 2, 2008 You need to turn error reporting on. It is likely that the fsockopen is disabled for some reason. Place this at the very top of the script.... <?php error_reporting(E_ALL) ; ini_set('display_errors','1'); ?> Also, remove the error supressor (@). Link to comment https://forums.phpfreaks.com/topic/93908-a-server-status-checker-that-works/#findComment-481247 Share on other sites More sharing options...
andrew121 Posted March 2, 2008 Author Share Posted March 2, 2008 Warning: fsockopen() [function.fsockopen]: unable to connect to allexser.dnsalias.net:90 (Connection timed out) in /home/content/a/l/l/allexser/html/test_login/test3/test.php on line 4 Offline Link to comment https://forums.phpfreaks.com/topic/93908-a-server-status-checker-that-works/#findComment-481263 Share on other sites More sharing options...
trq Posted March 2, 2008 Share Posted March 2, 2008 Theres your problem. Are you sure your firewall allows you to use port 90? Link to comment https://forums.phpfreaks.com/topic/93908-a-server-status-checker-that-works/#findComment-481265 Share on other sites More sharing options...
andrew121 Posted March 2, 2008 Author Share Posted March 2, 2008 yes im sure Link to comment https://forums.phpfreaks.com/topic/93908-a-server-status-checker-that-works/#findComment-481267 Share on other sites More sharing options...
geethalakshmi Posted April 18, 2008 Share Posted April 18, 2008 Hi, Below link gives you a script to check the server status. http://www.hiox.org/index.php?id=195 Regards Geethalakshmi http://www.hiox.org/ http://www.zxcvbnm.in/ Link to comment https://forums.phpfreaks.com/topic/93908-a-server-status-checker-that-works/#findComment-520203 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.