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. Quote Link to comment 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 Quote Link to comment Share on other sites More sharing options...
andrew121 Posted March 1, 2008 Author Share Posted March 1, 2008 what do you mean? Quote Link to comment 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? Quote Link to comment 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. Quote Link to comment 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 Quote Link to comment 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 Quote Link to comment 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. Quote Link to comment 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. Quote Link to comment 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 Quote Link to comment 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. Quote Link to comment 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 Quote Link to comment 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. Quote Link to comment Share on other sites More sharing options...
andrew121 Posted March 1, 2008 Author Share Posted March 1, 2008 how do i do this? Quote Link to comment 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 (@). Quote Link to comment 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 Quote Link to comment 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? Quote Link to comment Share on other sites More sharing options...
andrew121 Posted March 2, 2008 Author Share Posted March 2, 2008 yes im sure Quote Link to comment 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/ Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.