PDA

View Full Version : Why won't this work >:{



Luke
16-02-2008, 10:23 AM
Ok, i have a shoutcast, and i also have some php stats.

But the stats won't work

Here's the link:
http://habtown.net/staff/frontend/stats.php

Here's the code:


<?php

$scdef = "Habtown"; // radio name here

$scip = "205.234.215.43"; // url here

$scport = "8052"; // port number here

$scpass = "******"; // password here
?>

<?php


$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);

}

?>

<body bgcolor="#FDDF85">

<font face="Verdana" size="1">

<p><br>

<? if($streamstatus == "1"){ echo "<meta http-equiv=\"refresh\" content=\"5;><body bgcolor=\"#FFFFFF\"><b>Online:</b> Yes <b>DJ:</b> $servertitle <b>Listeners:</b> $currentlisteners <b> Song: </b> $song[0]"; } else { echo "<b>Online:</b> No"; } ?>

</p>

</p>



</body>



</html>



Anyone any idea's?

Btw, the radio is online at this present moment

Luke
16-02-2008, 09:58 PM
anyone?

Independent
16-02-2008, 10:11 PM
argh.

Erm, if you edited the stats, are you sure the slashes are in before the quotes (In the php.)

MrCraig
16-02-2008, 10:14 PM
Dont bump thread 8-)

And youve put in details wrong/your shoutcast aint working

Moh
16-02-2008, 10:22 PM
Contact your host and ask them to alow you to use port 8052. Then they will work :D

Want to hide these adverts? Register an account for free!