Script

metra52

New Member
Messages
18
Reaction score
0
Points
0
Help me with this script. adress to this script http://onlydc.co.cc/status.php
Code:
<?php 
//Configuration 
$scdef  =       "NoN-StoP";  
                                            // ABOVE: Default station name to display when server or stream is down 
$scip   =       "free.freeshoutcast.com";           // ip or url of shoutcast server (DO NOT ADD HTTP:// don't include the port) 
$scport =       "7950";                     // port of shoutcast server 
$scpass =       "l14124";              // password to shoutcast server 
 
$refreshrate =  "200";                       // Script/Page refresh time 
$bgcolor =      "#ffffff"; // page background colour, hex value, default = white, #ffffff 
 
//End configuration 
//*********** PUT YOUR INFO HERE ***********// 
 
$scfp = fsockopen("$scip", $scport, &$errno, &$errstr, 30); 
 if(!$scfp) { 
  $scsuccs=1; 
echo''.$scdef.' is<font color="red"> Offline</font>'; 
 } 
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 
######################################################################################################################
//max listeners

include "max.php";
if ($currentlisteners>$max)
        {
            $txtout='<?php'."\r\n";
            $txtout=$txtout. '$max=' .$currentlisteners. ";\r\n";
            $txtout=$txtout."\r\n".'?>';
            $fp = fopen ("max.php", "w"); 
            fwrite($fp,$txtout); 
            fclose($fp);
            $max=$currentlisteners;
        }


###################################################################################################################### 
/////////////////////////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
$mas = explode("~", $servertitle);
//echo $mas[2];
$kart= explode("^",$servertitle);
$t = $mas[1];

if($kart[1] == 'Metra ~ 85015854')
{
echo'<img src="http://metra.gtproff.com/RJ_Metra.png" wigth="190" height="80" alt="">';
 }

if($kart[1] == 'Nuggets ~ 5886724')
{
echo'<img src="http://metra.gtproff.com/RJ_nuggets.jpg" wigth="190" height="80" alt="">';
 }

if($kart[1] == 'Lev ~ 3074854')
{
echo'<img src="http://metra.gtproff.com/RJ_Lev.jpg" wigth="190" height="80" alt="">';
 }

if($kart[1] == 'Nabos ~ 3678944')
{
echo'<img src="http://metra.gtproff.com/rj_nabos.png" wigth="190" height="80" alt="">';
 }

if($kart[1] == 'NoN Stop')
{
echo'<img src="http://metra.gtproff.com/non_stoprj.jpg" wigth="190" height="80" alt="">';
 }


if($kart[1] == 'Konfetk@ ~ 588148781')
{
echo'<img src="http://metra.gtproff.com/RJ_k@nfetka.jpg" wigth="190" height="80" alt="">';
 }



if($kart[1] == 'Ekstazi ~ 444079958')
{
echo'<img src="http://metra.gtproff.com/RJ_Ekstazi.jpg" wigth="190" height="80" alt="">';
 }

//echo $icq[0]; 

echo'


'; 
 

} 
if($streamstatus == "0") 
{ 
//you may edit the html below, make sure to keep variable intact 
echo' <img src="http://metra.gtproff.com/offline.jpg" wigth="190" height="80" alt="">'; 
} 
?>
<html>
<meta http-equiv="refresh" content="60">
</html>
this is my script check and fix it if you can
script should work as this http://fry-diz.ru/metra/status.php
 

Anna

I am just me
Staff member
Messages
11,751
Reaction score
581
Points
113
*moved to programming help*
 

metra52

New Member
Messages
18
Reaction score
0
Points
0
I think I need a function parsing data from remote server
 

misson

Community Paragon
Community Support
Messages
2,572
Reaction score
72
Points
48
What, exactly, is the problem? Since we're not psychics, you should tell us the behavior you expect and the behavior you get, including any error messages. If you're having problems completing the code, tell us in detail what functionality you have and what you still need to achieve. Aways briefly describe the overall goal.

Read and follow the guidelines in "How To Ask Questions The Smart Way".
 
Last edited:

Livewire

Abuse Compliance Officer
Staff member
Messages
18,169
Reaction score
216
Points
63
I'm pretty sure the issue is that it's trying to open a remote connection on a port blocked by the firewall:
$scport = "7950";

and

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

If that's the case there's nothing you can do to fix this. X10 won't open ports for free accounts on demand, and it's tough to get one opened on paid too.
 
Top