Usamos cookies para medir audiência e melhorar sua experiência. Você pode aceitar ou recusar a qualquer momento. Veja sobre o iMasters.
Então, já tentei vários códigos daqui, de outros sites também. E NADA!
Tenho certeza que é ShoutCast, e boto, no Localhost da certo!
Já no site não! Fica carregando 1 ano e depois da erro, aparece um ERROR LOG NO FTP
Código utilizado:
<?php
$sc_url_ip = "74.222.3.176";
$sc_url_port = "17308";
function getNowPlaying($sc_url_ip,$sc_url_port)
{
$open = fsockopen($sc_url_ip,$sc_url_port);
if ($open) {
fputs($open,"GET /7.html HTTP/1.1\nUser-Agent:Mozilla\n\n");
stream_set_timeout($open,'1');
$read = fread($open,200);
$text = explode(",",$read);
if($text[6] == '' || $text[6] == '</body></html>'){ $msg = ' live stream '; } else { $msg = $text[6]; }
$text = $msg;
} else { return false; }
fclose($open);
return $text;
}
$current_song = getNowPlaying($sc_url_ip,$sc_url_port);
print $current_song;
?>
PODEM TENTAR AI NO LOCALHOST, TA FUNCIONANDO PERFEITAMENTE!!!
NA HOSPEDAGEM QUE É DA MESMA EMPRESA NÃO FUNCIONA...
Olhem O LOG:
[22-Dec-2012 05:11:43 America/New_York] PHP Warning: fsockopen() [<a href='function.fsockopen'>function.fsockopen</a>]: unable to connect to 74.222.3.176:17308 (Connection timed out) in /home/hotelevo/public_html/site/radio/play.php on line 10
[22-Dec-2012 05:11:45 America/New_York] PHP Warning: fsockopen() [<a href='function.fsockopen'>function.fsockopen</a>]: unable to connect to 74.222.3.176:17308 (Connection timed out) in /home/hotelevo/public_html/site/radio/play.php on line 10
[22-Dec-2012 05:12:45 America/New_York] PHP Warning: fsockopen() [<a href='function.fsockopen'>function.fsockopen</a>]: unable to connect to 74.222.3.176:17308 (Connection timed out) in /home/hotelevo/public_html/site/radio/play.php on line 10
[22-Dec-2012 05:13:45 America/New_York] PHP Warning: fsockopen() [<a href='function.fsockopen'>function.fsockopen</a>]: unable to connect to 74.222.3.176:17308 (Connection timed out) in /home/hotelevo/public_html/site/radio/play.php on line 10
[22-Dec-2012 05:15:06 America/New_York] PHP Warning: fsockopen() [<a href='function.fsockopen'>function.fsockopen</a>]: unable to connect to 74.222.3.176:17308 (Connection timed out) in /home/hotelevo/public_html/site/radio/play.php on line 10
[22-Dec-2012 05:15:10 America/New_York] PHP Warning: fsockopen() [<a href='function.fsockopen'>function.fsockopen</a>]: unable to connect to 74.222.3.176:17308 (Connection timed out) in /home/hotelevo/public_html/site/radio/play.php on line 10
[22-Dec-2012 05:19:54 America/New_York] PHP Warning: fsockopen() [<a href='function.fsockopen'>function.fsockopen</a>]: unable to connect to 74.222.3.176:17308 (Connection timed out) in /home/hotelevo/public_html/site/radio/play.php on line 10
[22-Dec-2012 05:21:24 America/New_York] PHP Warning: fsockopen() [<a href='function.fsockopen'>function.fsockopen</a>]: unable to connect to 74.222.3.176:17308 (Connection timed out) in /home/hotelevo/public_html/site/radio/play.php on line 10
[22-Dec-2012 05:22:24 America/New_York] PHP Warning: fsockopen() [<a href='function.fsockopen'>function.fsockopen</a>]: unable to connect to 74.222.3.176:17308 (Connection timed out) in /home/hotelevo/public_html/site/radio/play.php on line 10
Alguém tem a solução?
Aff cara olha o erro.
uai mano aqui foi pra pagina http://hotelevolution.meuhabbo.com.br/ :Z
o poblema é na sua hospedagem veja na minah funciona certinho. VER FUCIONANDO
eu arrumo uma hospedagem pra você como a minha ilimitada entre em contato comigo pelo msn está em meu perfil
Por segurança você não pode acessar uma porta diretamente a partir de outro servidor, atualmente para esse tipo de operação utilize:
$host = "127.0.0.1";
$port = "8000";
$ctx = stream_context_create(array('http' => array('timeout' => 10)));
@ini_set('user_agent', 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.0.10) Gecko/2009042316 SHOUTcast/1.9.8');
$cgi = "http://$host:$port/admin.cgi?mode=viewxml&pass=$pass";
$dump = @file_get_contents($cgi, 10, $ctx);
$shoutcast_xml = new SimpleXMLElement($dump);
$currentSong = utf8_decode($shoutcast_xml->SONGTITLE);
OBS: Nunca utilize o IP e a porta do seu streaming de trabalho, em exemplos, crie uma conta temporária em qualquer serviço de streaming grátis para isso. Esse IP (74.222.3.176) foi banido do Datacenter porque sofreu ataque DDoS.
<?php
$ip = "74.222.3.176"; //ip do streaming
$port = "17308"; // porta do streaming
$conexao = @fsockopen($ip,$port,$errno,$errstr,1); // conectar ao streaming
else{
fputs($conexao, "GET /7.html HTTP/1.0\r\nUser-Agent: Mozilla\r\n\r\n"); //pagina de conexão exemplo http://74.222.3.176:17308/7.html
while (!feof($conexao)) {
$resultado = explode(',', $dados);// fazer arrya dividido por ,
echo($resultado[6]);// mostra o 6 resultado exemplo 0,1,2,100,0,64,Rihanna - Talk That Talk
}
?>