TomBullock Posted October 29, 2007 Share Posted October 29, 2007 Hello everyone. Im just in the middle of building my website and i need a script that shows my users if the radio server is online or offline. Prefferable saying 'Online' in green when on, and 'Offline' in red when its off. Ive honestly been looking for ages, i tried up to about page 15 of Google results, many forums, and no luck at all. Im hoping this is where i can finnally get this script Please can anyone help me? Many thanks Tom Bullock Quote Link to comment https://forums.phpfreaks.com/topic/75279-solved-server-status-script/ Share on other sites More sharing options...
Wuhtzu Posted October 29, 2007 Share Posted October 29, 2007 Radio server? <?php //Get this from somewhere ?? $status = if($status == 'on') { echo '<p style="color: green;">Online</p>'; } else if($status == 'off') { echo '<p style="color: red;">Offline</p>'; } else { echo 'Some error...'; } ?> If the above simple code wasn't what you were wanting help for you must post more detail about the "radio server", how you can communicate with it, what it runs ect. Quote Link to comment https://forums.phpfreaks.com/topic/75279-solved-server-status-script/#findComment-380734 Share on other sites More sharing options...
TomBullock Posted October 29, 2007 Author Share Posted October 29, 2007 Yes a radio server. For the script you have given above, is there a second part to it that defines the i.p address and port of the radio server? Many thanks Tom Bullock Quote Link to comment https://forums.phpfreaks.com/topic/75279-solved-server-status-script/#findComment-380740 Share on other sites More sharing options...
Wuhtzu Posted October 29, 2007 Share Posted October 29, 2007 There is no standard script to check the status of a "radio server" because "radio server" is no standard thing / definition. I don't know what your radio server do. That's the only tough part of this script. How to get the actual status of the server (cf. //Get this from somewhere? $status = ). Your server must run some software and since it has something to do with radio it maybe stream / broad cast stuff? That software need to have a build in function which tells the status of the server. More info.... Quote Link to comment https://forums.phpfreaks.com/topic/75279-solved-server-status-script/#findComment-380751 Share on other sites More sharing options...
TomBullock Posted October 29, 2007 Author Share Posted October 29, 2007 Ive just been informed that we've had a change of plan. It is now a webserver that we want to show the status of. The same applies as in 'Online' green, 'Offline' red. The i.p address is 81.97.108.170 and the port number is 80. If you need anymore info, please ask. Many thanks Tom Bullock Quote Link to comment https://forums.phpfreaks.com/topic/75279-solved-server-status-script/#findComment-380762 Share on other sites More sharing options...
Wuhtzu Posted October 29, 2007 Share Posted October 29, 2007 Well if the webserver is online it should be able to answer a http request, so all you need is to send a http request to the server and see if you get an answer. I'm no expert when it comes to this, but I guess you have to look into cURL. Quote Link to comment https://forums.phpfreaks.com/topic/75279-solved-server-status-script/#findComment-380774 Share on other sites More sharing options...
rlindauer Posted October 29, 2007 Share Posted October 29, 2007 Maybe something like these? http://www.phpfreaks.com/script/view/369.php http://freshmeat.net/projects/phpservmon/ Quote Link to comment https://forums.phpfreaks.com/topic/75279-solved-server-status-script/#findComment-380781 Share on other sites More sharing options...
TomBullock Posted October 30, 2007 Author Share Posted October 30, 2007 Yes, the same principal, but just a script where i can enter the i.p address and port number of my server into the script and when the server is online it says 'Online' in green and when it is offline is says 'Offline' in red. Many thanks Tom Bullock Quote Link to comment https://forums.phpfreaks.com/topic/75279-solved-server-status-script/#findComment-381238 Share on other sites More sharing options...
atlanta Posted October 30, 2007 Share Posted October 30, 2007 <?php $server = "127.0.0.1"; $port = "80"; $timeout = "10"; if ($server and $port and $timeout) { $verbinding = @fsockopen("$server", $port, $errno, $errstr, $timeout); } if($verbinding) { echo "<img src='./images/on.gif'>Website is online<br>"; } else { echo "<img src='./images/off.gif'>Website is offline<br>"; } fclose($verbinding); ?> Quote Link to comment https://forums.phpfreaks.com/topic/75279-solved-server-status-script/#findComment-381245 Share on other sites More sharing options...
aschk Posted October 30, 2007 Share Posted October 30, 2007 I hope you're going to close that socket Quote Link to comment https://forums.phpfreaks.com/topic/75279-solved-server-status-script/#findComment-381254 Share on other sites More sharing options...
atlanta Posted October 30, 2007 Share Posted October 30, 2007 oppps fsockopen Quote Link to comment https://forums.phpfreaks.com/topic/75279-solved-server-status-script/#findComment-381259 Share on other sites More sharing options...
TomBullock Posted October 30, 2007 Author Share Posted October 30, 2007 <?php $server = "127.0.0.1"; $port = "80"; $timeout = "10"; if ($server and $port and $timeout) { $verbinding = @fsockopen("$server", $port, $errno, $errstr, $timeout); } if($verbinding) { echo "<img src='./images/on.gif'>Website is online<br>"; } else { echo "<img src='./images/off.gif'>Website is offline<br>"; } fclose($verbinding); ?> Yes that is exactly what im looking for except instead of having images to display the status, i need it to be text. Many thanks Tom Bullock Quote Link to comment https://forums.phpfreaks.com/topic/75279-solved-server-status-script/#findComment-381305 Share on other sites More sharing options...
atlanta Posted October 30, 2007 Share Posted October 30, 2007 <?php $server = "127.0.0.1"; $port = "80"; $timeout = "10"; if ($server and $port and $timeout) { $verbinding = @fsockopen("$server", $port, $errno, $errstr, $timeout); } if($verbinding) { echo "<img src='./images/on.gif'>Website is online<br>"; } else { echo "<img src='./images/off.gif'>Website is offline<br>"; } fclose($verbinding); ?> Yes that is exactly what im looking for except instead of having images to display the status, i need it to be text. Many thanks Tom Bullock ok just use this and change the text as wanted <?php $server = "127.0.0.1"; $port = "80"; $timeout = "10"; if ($server and $port and $timeout) { $verbinding = @fsockopen("$server", $port, $errno, $errstr, $timeout); } if($verbinding) { ?> <font color="green">Online</font> <? } else { ?> <font color="red">Offline</font> <? } fclose($verbinding); ?> Quote Link to comment https://forums.phpfreaks.com/topic/75279-solved-server-status-script/#findComment-381318 Share on other sites More sharing options...
TomBullock Posted October 30, 2007 Author Share Posted October 30, 2007 Thank you very much I really apreciate it Thanks again Quote Link to comment https://forums.phpfreaks.com/topic/75279-solved-server-status-script/#findComment-381330 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.