Old 25th May 2002, 04:55   #1
LoKoRg
Junior Member
 
Join Date: Feb 2001
Location: Third planet around the Sun
Posts: 32
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
LoKoRg is offline   Reply With Quote
Old 25th May 2002, 04:59   #2
Tom
Moderator
 
Join Date: Apr 2000
Posts: 4,491
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
Tom is offline   Reply With Quote
Old 25th May 2002, 05:21   #3
LoKoRg
Junior Member
 
Join Date: Feb 2001
Location: Third planet around the Sun
Posts: 32
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 ...
LoKoRg is offline   Reply With Quote
Old 25th May 2002, 05:31   #4
Tom
Moderator
 
Join Date: Apr 2000
Posts: 4,491
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

Tom is offline   Reply With Quote
Old 25th May 2002, 08:03   #5
Jay
Moderator Alumni
 
Jay's Avatar
 
Join Date: May 2000
Location: Next Door
Posts: 8,942
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
Jay is offline   Reply With Quote
Old 25th May 2002, 11:52   #6
Shirow
Major Dude
 
Shirow's Avatar
 
Join Date: Dec 2000
Posts: 604
/me goes and hammers refresh

Shirow is offline   Reply With Quote
Old 11th August 2002, 07:30   #7
I.mJustBrowsing
Junior Member
 
Join Date: Aug 2002
Posts: 5
Just wondering if anyone might have an ASP version to KXRMs PHP code solution for online/offline script.

Thanks
Browsing
I.mJustBrowsing is offline   Reply With Quote
Old 16th April 2006, 01:23   #8
ryu701
Junior Member
 
ryu701's Avatar
 
Join Date: Apr 2006
Posts: 11
I need an ASP version to KXRMs PHP code solution for online/offline script please...
ryu701 is offline   Reply With Quote
Old 17th April 2006, 00:49   #9
jeffy777
Major Dude
 
jeffy777's Avatar
 
Join Date: Jan 2006
Posts: 632
Well, no one has posted one in this thread since it started 4 years ago But maybe there's one out there.......

PHP > ASP
jeffy777 is offline   Reply With Quote
Old 17th April 2006, 01:03   #10
ryu701
Junior Member
 
ryu701's Avatar
 
Join Date: Apr 2006
Posts: 11
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
ryu701 is offline   Reply With Quote
Reply
Go Back   Winamp & Shoutcast Forums > Shoutcast > Shoutcast Discussions

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump