Go Back   Winamp Forums > SHOUTcast > SHOUTcast Technical Support

Reply
Thread Tools Search this Thread Display Modes
Old 20th October 2004, 02:17   #1
JamJar
Registered User
 
Join Date: Aug 2004
Posts: 68
Send a message via AIM to JamJar Send a message via Yahoo to JamJar
Shoutcast code is showing Error

On my website if my stream is offline it hsows this:

Warning: fsockopen(): unable to connect to Hitz106.Servemp3.com:9020 in /home/****/public_html/index.php on line 79
Hitz106.com - #1 FOR HIP-HOP R&B is Offline

I would prefer if it would only show something like

Hitz106.com Is Currently Offline or Hitz106.com Servers are offline

please help
JamJar is offline   Reply With Quote
Old 20th October 2004, 03:08   #2
101
Major Dude
 
101's Avatar
 
Join Date: Jul 2004
Location: Argentina
Posts: 828
Send a message via ICQ to 101
Wouldn't be difficult to modify that with a little knowledge of PHP, if you can't do it yourself, post your stats script.

Words are very unnecessary, they can only do harm, so enjoy the silence - Depeche Mode
Firemonger Project: Help spread Firefox
101 is offline   Reply With Quote
Old 21st October 2004, 01:43   #3
JamJar
Registered User
 
Join Date: Aug 2004
Posts: 68
Send a message via AIM to JamJar Send a message via Yahoo to JamJar
hey umm it is this


//Configuration
$scdef = "Hitz106.com - #1 FOR HIP-HOP R&B";// Default station name to display when server or stream is down
$scip = "**************"; // ip or url of shoutcast server
$scport = "9020";// port of shoutcast server
$scpass = "***********"; // password to shoutcast server
//End configuration
JamJar is offline   Reply With Quote
Old 21st October 2004, 02:52   #4
101
Major Dude
 
101's Avatar
 
Join Date: Jul 2004
Location: Argentina
Posts: 828
Send a message via ICQ to 101
No, that's variables used for the script not code part that you have to modify.

Words are very unnecessary, they can only do harm, so enjoy the silence - Depeche Mode
Firemonger Project: Help spread Firefox
101 is offline   Reply With Quote
Old 16th November 2004, 15:51   #5
JamJar
Registered User
 
Join Date: Aug 2004
Posts: 68
Send a message via AIM to JamJar Send a message via Yahoo to JamJar
Well hey here is the one from my website Index.php can u please edit is so when my servers are not online it will say Hitz106.com is currently offline or Hitz106.com - #1 FOR HIP-HOP R&B. Also do you think you could by any change add an Iframe so the current song will update and not the whole page?


<?php
// Shoutcast Server Stats
// Parses shoutcasts xml to make an effective stats thing for any website
// hardcore coded by daniel brown aka xbrowniex ©www.gmtt.co.uk 2003.
include('config_radio.php'); //you may edit this path to fit your server environment otherwise leave it alone
$scfp = fsockopen("$scip", $scport, &$errno, &$errstr, 30);
if(!$scfp) {
$scsuccs=1;
echo''.$scdef.' is Offline';
}
if($scsuccs!=1){
fputs($scfp,"GET /admin.cgi?pass=$scpass&mode=viewxml HTTP/1.0\r\nUser-Agent: SHOUTcast Song Status (Mozilla Compatible)\r\n\r\n");
while(!feof($scfp)) {
$page .= fgets($scfp, 1000);
}
######################################################################################################################
/////////////////////////part 1 \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
//define xml elements
$loop = array("STREAMSTATUS", "BITRATE", "SERVERTITLE", "CURRENTLISTENERS");
$y=0;
while($loop[$y]!=''){
$pageed = ereg_replace(".*<$loop[$y]>", "", $page);
$scphp = strtolower($loop[$y]);
$$scphp = ereg_replace("</$loop[$y]>.*", "", $pageed);
if($loop[$y]==SERVERGENRE || $loop[$y]==SERVERTITLE || $loop[$y]==SONGTITLE || $loop[$y]==SERVERTITLE)
$$scphp = urldecode($$scphp);

// uncomment the next line to see all variables
//echo'$'.$scphp.' = '.$$scphp.'<br>';
$y++;
}
//end intro xml elements
######################################################################################################################
######################################################################################################################
/////////////////////////part 2\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
//get song info and history
$pageed = ereg_replace(".*<SONGHISTORY>", "", $page);
$pageed = ereg_replace("<SONGHISTORY>.*", "", $pageed);
$songatime = explode("<SONG>", $pageed);
$r=1;
while($songatime[$r]!=""){
$t=$r-1;
$playedat[$t] = ereg_replace(".*<PLAYEDAT>", "", $songatime[$r]);
$playedat[$t] = ereg_replace("</PLAYEDAT>.*", "", $playedat[$t]);
$song[$t] = ereg_replace(".*<TITLE>", "", $songatime[$r]);
$song[$t] = ereg_replace("</TITLE>.*", "", $song[$t]);
$song[$t] = urldecode($song[$t]);
$dj[$t] = ereg_replace(".*<SERVERTITLE>", "", $page);
$dj[$t] = ereg_replace("</SERVERTITLE>.*", "", $pageed);
$r++;
}
//end song info

fclose($scfp);
}

//display stats
if($streamstatus == "1"){
//you may edit the html below, make sure to keep variable intact
echo'
<html>

<head>
<meta name="GENERATOR" content="Microsoft FrontPage 5.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<META HTTP-EQUIV="REFRESH" CONTENT="30;URL=radio_stats.php">
<link rel=stylesheet href="" type="text/css">
<title>'.$scdef.'</title>
</head>

<body text="" bgcolor="">




<p align="center"><center>

<font face="arial" size="2"><b>&nbsp;Server Name:</b>&nbsp;'.$servertitle.'</font></p>
<font face="arial" size="2"><b>&nbsp;Listeners:</b>&nbsp;'.$currentlisteners.' / 10</font></p>

<font face="arial" size="2" color=""><b>

Current Song:</b> '.$song[0].'</font></p>
<b>


<font face="arial" size="2">
Past Songs:</font></b>
<font color=""><font face="arial" size="2">
<p align="center">
<b>1.</b> '.$song[1].'<BR>
<b>2.</b> '.$song[2].'<BR>
<b>3.</b> '.$song[3].'<BR>
<b>4.</b> '.$song[4].'<BR>
<b>5.</b> '.$song[5].'<BR>
</font>
<BR>
</p></p>
</body>

</html>';
}
?>
JamJar is offline   Reply With Quote
Old 18th November 2004, 08:53   #6
101
Major Dude
 
101's Avatar
 
Join Date: Jul 2004
Location: Argentina
Posts: 828
Send a message via ICQ to 101
Just find the first excutable line and add a '@' in front of it:

@$scfp = fsockopen("$scip", $scport, &$errno, &$errstr, 30);

This will prevent the warning to appear when the DNAS is down. Just one thing, that script doesn't show anything if the DNAS is running but there's no stream. To fix that, add the line below to the last part of the code, just after the last '}' and before the PHP closing tag '?>':

elseif($scsuccs!=1) { echo "Server is up but no stream is available"; }

Besides, the script's author forgot to add // stolen from casterclub's sc_song script
I didn't understand what you mean by updating just the current song, loading the script on an iframe inside your homepage for example, will refresh just the content of the frame [ie: current and played songs] without reloading the main page.

Words are very unnecessary, they can only do harm, so enjoy the silence - Depeche Mode
Firemonger Project: Help spread Firefox
101 is offline   Reply With Quote
Old 19th November 2004, 19:15   #7
JamJar
Registered User
 
Join Date: Aug 2004
Posts: 68
Send a message via AIM to JamJar Send a message via Yahoo to JamJar
how do I put it in an iframe so it only update the song n' not the whole page

can u put it in one for me?
JamJar is offline   Reply With Quote
Old 20th November 2004, 00:10   #8
101
Major Dude
 
101's Avatar
 
Join Date: Jul 2004
Location: Argentina
Posts: 828
Send a message via ICQ to 101
That question was answered here.

Words are very unnecessary, they can only do harm, so enjoy the silence - Depeche Mode
Firemonger Project: Help spread Firefox
101 is offline   Reply With Quote
Reply
Go Back   Winamp Forums > SHOUTcast > SHOUTcast Technical Support

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