- Joined
- Nov 6, 2010
- Messages
- 1,561
- Reaction score
- 394
Greetz!
I forgot to release this to you guys a while back. This script uses the XML statistics given off by the Shoutcast server and parses them accordingly, to whichever variable you need. I realize the PHP is messy, but that's only because I got lucky enough and found the correct parser, and fixed it accordingly.
Page Definitions
listeners.php - Parses the current listeners XML.
currentdj.php - Parses the stream title XML. In SAM Broadcaster, configure your stream title for your encoder and make it DJ-(Name) for this to properly work.
Download:
Instructions:
1. Extract the contents.
2. Properly configure all of the files by replacing SHOUTCAST-IP:SHOUTCAST-PORT with your IP and port, so it looks like so: 123.456.789.10:8000, only, with YOUR IP and port.
How do I use this?
Listeners:
Current DJ:
Current Song:
Here's some example code I use, which also automatically updates the script. You can modify it to only display one variable, if you choose, so you can use file_get_contents() to get the contents of this and have them echo on the page, and they'll still automatically update!
Good luck with the scripts!
I forgot to release this to you guys a while back. This script uses the XML statistics given off by the Shoutcast server and parses them accordingly, to whichever variable you need. I realize the PHP is messy, but that's only because I got lucky enough and found the correct parser, and fixed it accordingly.
Page Definitions
listeners.php - Parses the current listeners XML.
currentdj.php - Parses the stream title XML. In SAM Broadcaster, configure your stream title for your encoder and make it DJ-(Name) for this to properly work.
Download:
To view the content, you need to sign in or register
Instructions:
1. Extract the contents.
2. Properly configure all of the files by replacing SHOUTCAST-IP:SHOUTCAST-PORT with your IP and port, so it looks like so: 123.456.789.10:8000, only, with YOUR IP and port.
How do I use this?
Listeners:
PHP:
<?php $listeners = file_get_contents('URL-OR-PATH-TO-LISTENERS.PHP'); echo $listeners; ?>
PHP:
<?php $dj = file_get_contents('URL-OR-PATH-TO-LISTENERS.PHP'); echo $dj; ?>
PHP:
<?php $currentsong = file_get_contents('http://SHOUTCAST-IP:PORT/currentsong?sid=1'); echo $currentsong; ?>
Here's some example code I use, which also automatically updates the script. You can modify it to only display one variable, if you choose, so you can use file_get_contents() to get the contents of this and have them echo on the page, and they'll still automatically update!
PHP:
<div id="loaddiv">
<b>Live DJ:</b>
<br>
<?php
$onlinedj = file_get_contents('currentdj.php'); echo $onlinedj;
?>
<br>
<b>Now Playing:</b>
<br>
<?php $currentsong = file_get_contents('http://SHOUTCAST-IP:SHOUTCAST-PORT/currentsong?sid=1');
echo $currentsong;
?>
<br>
<b>Listeners:</b>
<br>
<?php
$listeners = file_get_contents('listeners.php');
echo $listeners;
?>
</div>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.0/jquery.min.js"></script>
Good luck with the scripts!

