Winamp & Shoutcast Forums

Winamp & Shoutcast Forums (http://forums.winamp.com/index.php)
-   Shoutcast Discussions (http://forums.winamp.com/forumdisplay.php?f=9)
-   -   any simple offline/online script? (http://forums.winamp.com/showthread.php?t=88790)

LoKoRg 25th May 2002 04:55

any simple offline/online script?
 
I need a little simple online/offline scripts...

...i hope in PHP.....

for what?
The XML parser don't show when the server is offline...
for example in mi signature (random generated), sometime show the status of my Shoutcast Stream (song name and time)

but when the radio is offline, the information is still the same, but i want to make the sig to change something like Now Offline, try later

To make this little thing kind of work..i put the last update time(Ultima Actualizacion in spanish in the signature), to show the strem is not avaible since that time...


i hope someone can help me

Tom 25th May 2002 04:59

In 1.8.9 of the DNAS there is STREAMSTATUS in the XML. If it is 1 then the DSP is connected, if it's 0 then no DSP, so the stream is down.

Tom

LoKoRg 25th May 2002 05:21

Quote:

Originally posted by Tom
In 1.8.9 of the DNAS there is STREAMSTATUS in the XML. If it is 1 then the DSP is connected, if it's 0 then no DSP, so the stream is down.

Tom

i have the 1.8.3 version...but maybe i go to update the version, and get better stats with the new W3C log....


thx ...

Tom 25th May 2002 05:31

Yeah an update would probably be the easiest route. You could call 7.html and extract the data (one of those numbers is STREAMSTATUS I forget which), however you would be opening two sockets. I suppose you could connect to index.html and extract the song title and stream status from there with only opening one socket if for some reason you are really attached to 1.8.3.

Tom

Jay 25th May 2002 08:03

Much easier, just do this

code:

<?php

function OfforOn($host, $port, $wait_sec)
{
$fp = fsockopen($host, $port, &$errstr, &$errno, $wait_sec);

if ($fp)
{
fputs($fp, "GET / HTTP/1.0\r\nUser-Agent:AmIoffOrOn\r\n\r\n");

$ret = fgets($fp, 255);

if (eregi("200", $ret))
{
return true;
}
else
{
return false;
}

fclose($fp);
}
else
{
return false;
}
}

echo "I am ";
if (OfforOn("audio.str3am.com", 4080, 1))
{
echo "On";
}
else
{
echo "Off";
}
?>


Yummy On or off sign, you can easily replace with images or just continue using text.

On heavy traffic sites I don't recommend using this script as it will flood your server.

See in action here

Shirow 25th May 2002 11:52

/me goes and hammers refresh

I.mJustBrowsing 11th August 2002 07:30

Just wondering if anyone might have an ASP version to KXRMs PHP code solution for online/offline script. :confused:

Thanks
Browsing:)

ryu701 16th April 2006 01:23

I need an ASP version to KXRMs PHP code solution for online/offline script please...

jeffy777 17th April 2006 00:49

Well, no one has posted one in this thread since it started 4 years ago :) But maybe there's one out there.......

PHP > ASP ;)

ryu701 17th April 2006 01:03

Yes, 4 years ago. :)

I tried PHP to ASP converters but the converted code didn't work. I don't know these languages but my guess is a command like "fsockopen" doesn't exist in ASP.

Anyway, I've found later that serverstatus with ASP has been discussed here:
http://forums.winamp.com/showthread....hreadid=135235


All times are GMT. The time now is 14:22.

Copyright © 1999 - 2010 Nullsoft. All Rights Reserved.