Vibe Streamer up Status display

saint

18-07-2007 22:21:07

Anyone found a way to display the up or done status of the streamer. I run a link from one web site to the vibestreamer url, next to the link I would like a green or red "led" to show whether or not the service is up or not.. I will continue to browse around, if I figure something out I will post it here..

thanks in advance.

Amish

18-07-2007 22:39:05

PHP coudl do it easy. Ill whip up a script tomorrow.

saint

18-07-2007 22:52:57

thanks,, thats what im workin on, but just learning php.. was hoping this would work

[code1odgpqui]
echo "<table border='0' align=center width='140' cellspacing='0' cellpadding='1' bordercolor='' style='border: 1 solid #DADADA'>

<td width='16'><img src='images/vibe-logo.jpg' title='Streamer'></td>";

$hostname = "www.2into-music.homedns.org";

echo "<td width='16'><img src='image.php?host=$hostname&port=8081'></td>";
[/code1odgpqui]

along with this

[code1odgpqui]
error_reporting(0);

header("Content-type: image/gif");


$fp = fsockopen($host, $port,$errno,$errstr, 4);
if (!$fp){
readfile('offline.gif');
} else {
readfile('online.gif');
fclose($fp);
}

[/code1odgpqui]

but that doesnt work.. says port is closed.. which it might be, might only open when someone connects to it. I just dont think "fsockopen" will work

saint

19-07-2007 02:16:55

Got it... I will work some more with it and post the final code, I think it might be usefull for everyone..maybe

[codewa6p7tjh]
<?
error_reporting(0); //Turns off the stupid error messege generated when the port is found to be closed.
$address ="2into-music.homedns.org"; //Here you can specify the address you want to check ports
$port = "8081"; //Here you can specify the port you want to check from $address
$checkport = fsockopen($address, $port, $errno, $errstr, 2); //The 2 is the time of ping in secs

//Here down you can put what to do when the port is closed
if(!$checkport){
echo "2into-music is currently down, please come back later."; //Only will echo that msg
}else{

//And here, what you want to do when the port is open
echo "2into-Music is currently available."; //The msg echoed if port is open
}
?>
[/codewa6p7tjh]

saint

19-07-2007 03:35:16

Ok I created a .rar with the code and images and a read me for anyone who would like to use this.

[url2k3njhgr]http://www.2into-design.com/mycodes/status.rar[/url2k3njhgr]

Amish

19-07-2007 21:20:49

Heres my soloution

[code2g55ee97]<?php

////////// EDIT HERE ///////////

$host = ''; //Put your IP address or Domain Name here.
$port = '8081'; //Put the port Vibe is running off here.
$timeout = 2; //Timeout in seconds to ping the service.


////////// STOP EDITING ///////////

$img = array(
'on'=>
'R0lGODlhDAAMANUAABl8BrDWngD/AF3DAFacTv///5vDmDOZAEeqBW7EKCR7H3W0XjuQJsjexiOF'.
'CECgDiqCHoDVK4K4dSmHER17EDqdB7LfjkGnAFqcVjSHK02yAiSKAD2iBCF6Gyh/Hk+1ADGMKSyB'.
'JrXWnCuKDj2cEFudVwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA'.
'AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACH5BAEHAAIALAAAAAAMAAwAAAZcQIFQ'.
'UCgWhsNCA6NQlBpHYUGSWVgsC4UkGvAkIuBIAhIgMh6DtJrEKHY0n7gcoXBzLvh8pVPMjA6AgRMZ'.
'RwYKDhuJGw4dBlIEHRQAABQdBFFEBiEdCiEGmElGSEEAOw==',
'off'=>
'R0lGODlhDAAMAMQAAJkAAOKysgD/AMdwcLg4OP///6AQEK8AANeRkc5BQea/v60nJ7gICN16erNC'.
'Qu7Q0OuysqUAAMQ0NLcAAKQbG8t7e54KCtySkrwKCqUQELw/PwAAAAAAAAAAAAAAAAAAACH5BAEH'.
'AAIALAAAAAAMAAwAAAVQoCAKRVmMY6E4AOAop1hUVPU8A1DFgXVBQMjFECAtNI2kkrAoARLQaEIC'.
'cGKuWAyjWshEJuBwJHNCAA5odASAkLEAkbgrRkIYWgYEPWVChQAAOw=='
);

$online = @fsockopen($host, $port, $errno, $errstr, $timeout);

$status = ($online ? $img['on'] : $img['off']);

header("Content-type: image/gif");
header("Cache-Control: no-cache, must-revalidate");
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");

echo base64_decode($status);

?>
[/code2g55ee97]

No need to have images its built in.

To use it use this code

[code2g55ee97]<IMG SRC="http://LOCATION TO SCRIPT/SCRIPTNAME.php">[/code2g55ee97]

Thats it.

saint

20-07-2007 00:04:43

very nice.... like i said im just learning )

nitramf

07-02-2008 14:19:30

Why you cryt the code?

U can build in backdoors.

Amish

09-02-2008 21:02:47

What do you mean?? I dont think you knwo what your talking about....

ddindia

07-06-2008 01:36:28

Amish, the php code works perfect, but I was wondering how you would you modify it to show text beside the coloured dot?

Vibe Streamer Status O

Thanks!
Dave

Amish

09-06-2008 10:06:24

Hey ddindia, yeah Do you want the text displayable in the image? That would be easier.

ddindia

18-06-2008 02:38:55

Whatever's easier, I was picturing something basic on my site, like

"The Vibestreamer status is (PHP COLOUR CODE)", which of course would be the coloured circle with the app status.

Amish

18-06-2008 09:35:22

sure ill code it today man ) and post it here soon

sbgstudios

20-08-2008 00:04:21

Is there any way to run this as a page in a website? Dont really know much about Http or php but wandering if it is possible.

Thanks

David