View Full Version : Pls Help with Now Playing Script

06-23-2010, 09:24 PM
Please can someone help me with a script? I've searched everywhere for ages now and have found a few but they do not do exactly what i'm after and i don't know php http://icecast.imux.net/images/smiles/icon_confused.gif

Basically my host only allows some functions so the php needs to use "fsockopen" as i know it works.

Just two rules:

If fsockopen is open then display the song artist/title

If fsockopen is closed then show Server Offline

I've tried loads now but the closest i got to one doesn't use fsockopen and the page keeps trying to load when server is offline instead of just displaying

06-24-2010, 09:29 AM
The below would be perfect but it is for a shoutcast server and i need icecast:

Can anyone convert?


<script type="text/javascript" src="./jquery.js"></script>
<script type="text/javascript">
function updateNowPlaying(){
url: "./now-playing.php",
cache: false,
success: function(html){
setInterval( "updateNowPlaying()", 10000 );
<body bgcolor="#171717">
<font size="3" color="ff0000"><b>
<div id="nowPlaying"></div></b>


Now Playing PHP script for SHOUTcast
This script is (C) MixStream.net 2008
Feel free to modify this free script
in any other way to suit your needs.
Version: v1.1

/* ----------- Server configuration ---------- */
$ip = "host.host.net";
$port = "9999";
/* ----- No need to edit below this line ----- */
/* ------------------------------------------- */
$fp = @fsockopen($ip,$port,$errno,$errstr,1);
if (!$fp)
echo "OFF AIR - Tune In At 6pm"; // Diaplays when sever is offline
fputs($fp, "GET /7.html HTTP/1.0\r\nUser-Agent: Mozilla\r\n\r\n");
while (!feof($fp))
$info = fgets($fp);
$info = str_replace('</body></html>', "", $info);
$split = explode(',', $info);
if (empty($split[6]) )
echo "The current song is not available"; // Diaplays when sever is online but no song title
$title = str_replace('\'', '`', $split[6]);
$title = str_replace(',', ' ', $title);
echo "$title"; // Diaplays song