Ir para conteúdo
Fórum Script Brasil
  • 0

Player de web radio


Matheus Bello

Pergunta

Ola Pessoal eu Sou novo aqui e desculpe se estou na area errada e que estou com uma duvida

Eu tenho um script php no qual e um player de web radio que mostra o locutor,programa atual,tocando agora,ouvintes conectados

e queria que eles se atualiza-se sozinho a cada 10 segundos mais sem dar refresh na pagina toda pois o player da radio esta junto numa div.

o arquivo principal tem um include que chama o arquivo status.php no qual requesita as informações do meu shoutcast

aqui vai o codigo do index.php e status.php

Index.php

<?php
include "status.php";
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<!-- saved from url=(0014)about:internet -->
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Player</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<style type="text/css">
td img {display: block;}body {
	background-repeat: repeat-y;
	margin-left: 0px;
	margin-top: 0px;
	margin-right: 0px;
	margin-bottom: 0px;
}
</style>
<!--Fireworks CS6 Dreamweaver CS6 target.  Created Tue Jul 22 14:32:04 GMT-0300 (Hora oficial do Brasil) 2014-->
</head>
<body bgcolor="#ffffff">
<table style="display: inline-table; color: #FFF; font-weight: bold; font-family: 'MS Serif', 'New York', serif;" border="0" cellpadding="0" cellspacing="0" width="1370">
<!-- fwtable fwsrc="Sem título" fwpage="Página 1" fwbase="index.png" fwstyle="Dreamweaver" fwdocid = "651578780" fwnested="0" -->
  <tr>
   <td><img src="imagens/spacer.gif" width="136" height="1" alt="" /></td>
   <td><img src="imagens/spacer.gif" width="279" height="1" alt="" /></td>
   <td><img src="imagens/spacer.gif" width="29" height="1" alt="" /></td>
   <td><img src="imagens/spacer.gif" width="300" height="1" alt="" /></td>
   <td><img src="imagens/spacer.gif" width="10" height="1" alt="" /></td>
   <td><img src="imagens/spacer.gif" width="396" height="1" alt="" /></td>
   <td><img src="imagens/spacer.gif" width="18" height="1" alt="" /></td>
   <td><img src="imagens/spacer.gif" width="92" height="1" alt="" /></td>
   <td><img src="imagens/spacer.gif" width="110" height="1" alt="" /></td>
   <td><img src="imagens/spacer.gif" width="1" height="1" alt="" /></td>
  </tr>

  <tr>
   <td colspan="9"><img name="index_r1_c1" src="imagens/index_r1_c1.png" width="1370" height="4" id="index_r1_c1" alt="" /></td>
   <td><img src="imagens/spacer.gif" width="1" height="4" alt="" /></td>
  </tr>
  <tr>
   <td colspan="3"><img name="index_r2_c1" src="imagens/index_r2_c1.png" width="444" height="2" id="index_r2_c1" alt="" /></td>
   <td rowspan="3" background="imagens/index_r2_c4.png"> Locutor: <?php echo $servertitle; ?></td>
   <td rowspan="2" colspan="5"><img name="index_r2_c5" src="imagens/index_r2_c5.png" width="626" height="11" id="index_r2_c5" alt="" /></td>
   <td><img src="imagens/spacer.gif" width="1" height="2" alt="" /></td>
  </tr>
  <tr>
   <td rowspan="7"><img name="index_r3_c1" src="imagens/index_r3_c1.png" width="136" height="64" id="index_r3_c1" alt="" /></td>
   <td rowspan="5" background="imagens/index_r3_c2.png"><center><object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="269" height="33" align="middle">
     <param name="movie" value="player/muses.swf" />
     <param name="flashvars" value="url=http://64.31.30.91:9986/;&amp;lang=auto&amp;codec=mp3&amp;volume=50&amp;introurl=&amp;autoplay=true&amp;tracking=true&amp;jsevents=false&amp;skin=player/hoost.xml&amp;title=Radio%20Electro Hits&amp;welcome=Bem%20Vindo" />
     <param name="wmode" value="transparent" />
     <param name="allowscriptaccess" value="always" />
     <param name="LOOP" value="false" />
     <embed src="player/muses.swf" width="269" type="application/x-shockwave-flash" height="33" flashvars="url=http://64.31.30.91:9986/;&amp;lang=auto&amp;codec=mp3&amp;volume=50&amp;introurl=&amp;autoplay=true&amp;tracking=true&amp;jsevents=false&amp;skin=player/hoost.xml&amp;title=Radio%20Electro Hits&amp;welcome=Bem%20Vindo" wmode="transparent" allowscriptaccess="always" align="middle" loop="false" />   
</object></center></td>
   <td rowspan="7"><img name="index_r3_c3" src="imagens/index_r3_c3.png" width="29" height="64" id="index_r3_c3" alt="" /></td>
   <td><img src="imagens/spacer.gif" width="1" height="9" alt="" /></td>
  </tr>
  <tr>
   <td rowspan="6"><img name="index_r4_c5" src="imagens/index_r4_c5.png" width="10" height="55" id="index_r4_c5" alt="" /></td>
   <td rowspan="3" background="imagens/index_r4_c6.png">Tocando Agora:<?php echo $musica; ?></td>
   <td rowspan="6"><img name="index_r4_c7" src="imagens/index_r4_c7.png" width="18" height="55" id="index_r4_c7" alt="" /></td>
   <td rowspan="3" background="imagens/index_r4_c8.png">Ouvintes:<?php echo $currentlisteners; ?></td>
   <td rowspan="6"><img name="index_r4_c9" src="imagens/index_r4_c9.png" width="110" height="55" id="index_r4_c9" alt="" /></td>
   <td><img src="imagens/spacer.gif" width="1" height="19" alt="" /></td>
  </tr>
  <tr>
   <td><img name="index_r5_c4" src="imagens/index_r5_c4.png" width="300" height="3" id="index_r5_c4" alt="" /></td>
   <td><img src="imagens/spacer.gif" width="1" height="3" alt="" /></td>
  </tr>
  <tr>
   <td rowspan="3" background="imagens/index_r6_c4.png">Programa: <?php echo $pe; ?></td>
   <td><img src="imagens/spacer.gif" width="1" height="18" alt="" /></td>
  </tr>
  <tr>
   <td rowspan="3"><img name="index_r7_c6" src="imagens/index_r7_c6.png" width="396" height="15" id="index_r7_c6" alt="" /></td>
   <td rowspan="3"><img name="index_r7_c8" src="imagens/index_r7_c8.png" width="92" height="15" id="index_r7_c8" alt="" /></td>
   <td><img src="imagens/spacer.gif" width="1" height="10" alt="" /></td>
  </tr>
  <tr>
   <td rowspan="2"><img name="index_r8_c2" src="imagens/index_r8_c2.png" width="279" height="5" id="index_r8_c2" alt="" /></td>
   <td><img src="imagens/spacer.gif" width="1" height="2" alt="" /></td>
  </tr>
  <tr>
   <td><img name="index_r9_c4" src="imagens/index_r9_c4.png" width="300" height="3" id="index_r9_c4" alt="" /></td>
   <td><img src="imagens/spacer.gif" width="1" height="3" alt="" /></td>
  </tr>
</table>
</body>
</html>

Status.php

<?php
header("Content-Type: text/html; charset=ISO-8859-1");
function encurta($str, $tam){
$num_car = $tam;
$palavra = strlen($str);
$nova_palavra = substr($str, 0, $num_car); 
if($palavra > $num_car){
return ''.$nova_palavra.'...';
} else {
return $str;
}
}
$host = "64.31.30.91";

$port = "9986";

$listenlink = 'http://64.31.30.91:9986';  //make link to stream



$fp = fsockopen("$host", $port, &$errno, &$errstr, 30); //open connection

if(!$fp) {

 $success=2;  //se-t if no connection

}

if($success!=2){ //if connection

 fputs($fp,"GET /index.html HTTP/1.0\r\nUser-Agent: XML Getter (Mozilla Compatible)\r\n\r\n"); //get 7.html

 while(!feof($fp)) {

  $pg .= fgets($fp, 1000);

 }

 fclose($fp); //close connection

 $paage = ereg_replace(".*<font class=default>Stream Title: </font></td><td><font class=default><b>", "", $pg); //extract data

 $paage = ereg_replace("</b></td></tr><tr><td width=100 nowrap>.*", "", $paage); //extract data

 $pge = ereg_replace(".*<font class=default>Stream Genre: </font></td><td><font class=default><b>", "", $pg); //extract data

 $pge = ereg_replace("</b></td></tr><tr><td width=100 nowrap>.*", "", $pge); //extract data

 $pe = ereg_replace(".*<font class=default>Stream Genre: </font></td><td><font class=default><b>", "", $pg); //extract data

 $pe = ereg_replace("</b></td></tr><tr><td width=100 nowrap>.*", "", $pe); //extract data

 $musica = ereg_replace(".*<font class=default>Current Song: </font></td><td><font class=default><b>", "", $pg); //extract data

 $musica = ereg_replace("</b></td></tr></table>.*", "", $musica); //extract data

 $numbers = explode(",",$paage); //extract data

 $servertitle=$numbers[0]; //set variable

 $connected=$numbers[1]; //set variable

}







$fp2 = fsockopen("$host", $port, &$errno, &$errstr, 30); //open connection

if(!$fp2) {

 $success2=2;  //se-t if no connection

}

if($success2!=2){ //if connection

 fputs($fp2,"GET /7.html HTTP/1.0\r\nUser-Agent: XML Getter (Mozilla Compatible)\r\n\r\n"); //get 7.html

 while(!feof($fp2)) {

  $pg2 .= fgets($fp2, 1000);

 }

 fclose($fp2); //close connection

$pag = ereg_replace(".*<body>", "", $pg2); //extract data

 $pag = ereg_replace("</body>.*", ",", $pag); //extract data

 $numbers = explode(",",$pag); //extract data

 $currentlisteners=$numbers[0]; //set variable

}
?>
Link para o comentário
Compartilhar em outros sites

2 respostass a esta questão

Posts Recomendados

Participe da discussão

Você pode postar agora e se registrar depois. Se você já tem uma conta, acesse agora para postar com sua conta.

Visitante
Responder esta pergunta...

×   Você colou conteúdo com formatação.   Remover formatação

  Apenas 75 emoticons são permitidos.

×   Seu link foi incorporado automaticamente.   Exibir como um link em vez disso

×   Seu conteúdo anterior foi restaurado.   Limpar Editor

×   Você não pode colar imagens diretamente. Carregar ou inserir imagens do URL.



  • Estatísticas dos Fóruns

    • Tópicos
      152,3k
    • Posts
      652,5k
×
×
  • Criar Novo...