Ir para conteúdo

POWERED BY:

Arquivado

Este tópico foi arquivado e está fechado para novas respostas.

LuisHD

Painel de pedidos de WebRadio

Recommended Posts

Galera consegui mais olhaaaaa

 

agora o painel num ta conectando com a radio para aparecer os ouvinte o problema e neesa linha

 

if($fp = fsockopen($sc[host], $sc[port]))

 

oq tem de errado?

 

Esse é o codigo inteiro

<?php
$cfg = fopen("statcfg.php", "r");
$size = filesize('statcfg.php') + 500;
$statcfg = fread($cfg, $size);
$tabcfg = explode('|', $statcfg);
  $sc_stan = $tabcfg[0];
if($sc_stan == 'nie') {
echo "-";
}
else if ($sc_stan == 'tak') {

  $sc[host]       =   "$tabcfg[1]";
  $sc[port]       =   $tabcfg[2];
 $sc[template]   =   "[ile]";
#   $sc[template]   =   "<b>Status (on/off/err) :</b> [status]<br><b>GG DJ-a:</b> [gg]<br><b>Dj:</b> [genre]<br><b>Ilu sluchaczy aktualnie/maksymalnie/peak:</b> [ile]/[max]/[peak]<br>";




?>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-2">
</head>
<body>
<?php
if($fp = fsockopen($sc[host], $sc[port]))
{
fputs($fp,"GET /index.html HTTP/1.0\r\nUser-Agent: XML Getter (Mozilla Compatible)\r\n\r\n");
fgets($fp);fgets($fp);fgets($fp);
      while(!feof($fp)) $in.=strip_tags(fgets($fp));
fclose($fp);
 # echo $in;

//  [status]
  $m[0]="Server is currently";
  $m[1]="";
  $mp[0]=strpos($in,$m[0]);
  $mp[1]=@strpos($in,$m[1]);
  $ml[0]=strlen($m[0]);
  $ml[1]=strlen($m[1]);

  $tmp[1]=explode( " " , trim( substr( $in , $mp[0] + $ml[0] , 5 ) ) );

  if( $tmp[1][0] == "up" )
      $dat[status] = "on";
  elseif( $tmp[1][0] == "down" )
      $dat[status] = "off";
  else
      $dat[status] = "err";

  if($dat[status]=="on")
  {
  //  [dj]
      $m[0]="Stream Title:";
      $m[1]="Content Type:";
      $mp[0]=strpos($in,$m[0]);
      $mp[1]=strpos($in,$m[1]);
      $ml[0]=strlen($m[0]);
      $ml[1]=strlen($m[1]);

      $tmp[1]=trim( substr( $in , $mp[0] + $ml[0] , $mp[1]-$mp[0]-$ml[1] ) );

      if( $tmp[1] ) $dat[dj] = $tmp[1];
      else $dat[dj] = "err";

  //  [gg]
      $m[0]="Stream AIM:";
      $m[1]="Stream IRC:";
      $mp[0]=strpos($in,$m[0]);
      $mp[1]=strpos($in,$m[1]);
      $ml[0]=strlen($m[0]);
      $ml[1]=strlen($m[1]);

      $tmp[1]=trim( substr( $in , $mp[0] + $ml[0] , $mp[1]-$mp[0]-$ml[1] ) );

      if( $tmp[1] ) $dat[gg] = $tmp[1];
      else $dat[gg] = "err";

  //  [genre]
      $m[0]="Stream Genre:";
      $m[1]="Stream URL:";
      $mp[0]=strpos($in,$m[0]);
      $mp[1]=strpos($in,$m[1]);
      $ml[0]=strlen($m[0]);
      $ml[1]=strlen($m[1]);

      $tmp[1]=trim( substr( $in , $mp[0] + $ml[0] , $mp[1]-$mp[0]-$ml[1]-2 ) );

      if( $tmp[1] ) $dat[genre] = $tmp[1];
      else $dat[genre] = "err";

  //  [ile]
      $m[0]="kbps with";
      $m[1]="listeners";
      $mp[0]=strpos($in,$m[0]);
      $mp[1]=strpos($in,$m[1]);
      $ml[0]=strlen($m[0]);
      $ml[1]=strlen($m[1]);

      $tmp[1]=explode( " " , trim( substr( $in , $mp[0] + $ml[0] , $mp[1]-$mp[0]-$ml[1]-2 ) ) );

      if( $tmp[1] ) $dat[ile] = $tmp[1][0];
      else $dat[ile] = "err";

  //  [max]
      $m[0]="kbps with";
      $m[1]="listeners";
      $mp[0]=strpos($in,$m[0]);
      $mp[1]=strpos($in,$m[1]);
      $ml[0]=strlen($m[0]);
      $ml[1]=strlen($m[1]);

      $tmp[1]=explode( " " , trim( substr( $in , $mp[0] + $ml[0] , $mp[1]-$mp[0]-$ml[1]-2 ) ) );

      if( $tmp[1] ) $dat[max] = $tmp[1][2];
      else $dat[max] = "err";

  //  [peak]
      $m[0]="Listener Peak:";
      $m[1]="Average";
      $mp[0]=strpos($in,$m[0]);
      $mp[1]=strpos($in,$m[1]);
      $ml[0]=strlen($m[0]);
      $ml[1]=strlen($m[1]);

      $tmp[1]=trim( substr( $in , $mp[0] + $ml[0] , $mp[1]-$mp[0]-$ml[1]-7) );

      if( $tmp[1] ) $dat[peak] = $tmp[1];
      else $dat[peak] = "err";


  }
}
else
{
  $dat=array();
  $dat[status]="err";
}

$co             =   array('[status]','[dj]','[gg]','[genre]','[ile]','[max]','[peak]');
$naco           =   array($dat[status],$dat[dj],$dat[gg],$dat[genre],$dat[ile],$dat[max],$dat[peak]);
$sc[template]   =   str_replace($co,$naco,$sc[template]);

echo $sc[template];
}
else {
echo "-";
}
?>
</body>

Compartilhar este post


Link para o post
Compartilhar em outros sites

Luis,

 

tenta o seguinte código:

<?php
$server = "shoutcast.internet-radio.org.uk"; 
$port = "0000"; // port of your internet radio server
$online = "<marquee> <p>We are online! :)</p> </marquee>"; // Online Message
$offline = "<marquee> <p>Sorry we are offline :( </p></marquee>"; // offline Message

// Start Data Collection
 $fp = fsockopen("$server", $port, $errno, $errstr, 30);
      fputs($fp, "GET /7.html HTTP/1.0\r\nUser-Agent: Mozilla/4.0 (compatible; MSIE 5.5; Windows NT 5.0)\r\n\r\n");
      while (!feof($fp)) {
          $content .= fgets($fp,128);
}
      fclose($fp);
// start data processing
      $debut = strpos($content, '<body>') + strlen('<body>');
      $fin = strpos($content, '</body>', $debut);
      $string = substr($content, $debut, $fin - $debut);
      $stats = explode(',', $string);

// Start Image generation
// Dedug Status echo "$stats[1]";
//offline
if ($stats[1] == "0" || !$stats) {
echo("$offline");
}

//online
if ($stats[1] == "1") {
echo("$online");
}

?> 

Boa sorte! http://forum.imasters.com.br/public/style_emoticons/default/thumbsup.gif

Compartilhar este post


Link para o post
Compartilhar em outros sites

×

Informação importante

Ao usar o fórum, você concorda com nossos Termos e condições.