Foros del Web » Programando para Internet » PHP »

Ayudenme maestros del PHP - Problema fsockopen

Estas en el tema de Ayudenme maestros del PHP - Problema fsockopen en el foro de PHP en Foros del Web. Hola amigos del foro... tengo un problema que he tratado resolverlo durante horas y horas.. (mas de 6 horas concentrado y nada ) Qisiera que ...
  #1 (permalink)  
Antiguo 04/11/2010, 20:10
 
Fecha de Ingreso: noviembre-2010
Mensajes: 1
Antigüedad: 13 años, 5 meses
Puntos: 0
Exclamación Ayudenme maestros del PHP - Problema fsockopen

Hola amigos del foro... tengo un problema que he tratado resolverlo durante horas y horas.. (mas de 6 horas concentrado y nada )

Qisiera que me ayuden con el " fsockopen "
tengo un script que me permite ver las estadisticas de una radio ShoutCAst

He visto que han ayudado a uno que tiene casi el mismo problema. lo vi aqui:
http://www.forosdelweb.com/f18/problema-con-fsockopen-521989/


Pero yo tengo otro script y la verdad nose mucho PHP
qisiera porfavor que me ayuden con mis codigos que tengo.. y corrijan mis errores :(

Ya que cada ves que qiero visualizarlo en internet (radio_stats.php) me sale este ERROR:

Warning: fsockopen() [function.fsockopen]: unable to connect to miip:puerto (Connection timed out) in /home/genteflo/public_html/ruler/radio_stats.php on line 8
OnlinesActualmente, no hay ningún DJ paciencia porfavor ;)



....... aqui les dejo mis archivos PHP que tengo:

radio_stats.php
Código PHP:
<?php
// Shoutcast Server Stats
// Parses shoutcasts xml to make an effective stats thing for any website
// Coded by Daniel Brown. Edited by Nick Coates [SharpeNews] KEEP THIS INTACT!!!
// Please refer to the readme file for use.
include('config_radio.php');  //you may edit this path to fit your server environment otherwise leave it alone
$scfp fsockopen("$scip"$scport, &$errno, &$errstr10);
 if(!
$scfp) {
  
$scsuccs=1;
echo
''.$scdef.'Actualmente, no hay ningún DJ paciencia porfavor ;)';
 }
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($scfp1000);
 }
######################################################################################################################
/////////////////////////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);
}

//display stats
if($streamstatus == "1"){
//you may edit the html below, make sure to keep variable intact
echo'
<html>

<head>
<meta name="GENERATOR" content="Microsoft FrontPage 6.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<META HTTP-EQUIV="REFRESH" CONTENT="30">
<link rel=stylesheet href="" type="text/css">
</head>

<body text="" bgcolor="#000000">

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

<font color="#FF0000"><b>DJ Name:</b></font><font color="black">&nbsp;</font><font color="#ffffff">'
.$servertitle.'</font><font color="black"><br>
</font>
</font><b>
 

    <font face="verdana" size="1" color="#FF0000">
   Cancion:</font></b><font color="black">
<font color="#ffffff"><font face="verdana" size="1">
 '
.$song[0].'
</font>
</p>
</html>'
;
}
if(
$streamstatus == "0")
{
//you may edit the html below, make sure to keep variable intact
echo'
<html>

<head>
<meta name="GENERATOR" content="Microsoft FrontPage 6.0">
<meta name="ProgId" content="FrontPage.Editor.document">
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<META HTTP-EQUIV="REFRESH" CONTENT="30;URL=radio_stats.php">
<link rel=stylesheet href="" type="text/css">
</head>

<body text="" bgcolor="" style="background-color: #E5E5E8">
<p align="center"><b><font color="#000000">no hay ningún DJ paciencia porfavor ;)
</font></b></p>
<div><center><img src="http://i42.tinypic.com/a1s38m.gif"></img></center></div>
</body>

</html>'
;
}
?></font>
</body>

y ese archivo se conecta con este otro php

config_radio.php
Código PHP:
<?php
//////////////////////////////////////////////////////////////////////////////////////////////
// Stats Information
// Grabs the xml from your radio server and displays it in a iframe that refreshes every 30 seconds.
//////////////////////////////////////////////////////////////////////////////////////////////
//Configuration
$scdef "Online";               // Default station name to display when server or stream is down
$scip "miip";               // ip or url of shoutcast server
$scport "mipuerto";             // port of shoutcast server
$scpass "mipassword";             // password to shoutcast server
//End configuration

?>
Porsiacaso si confire los 2 archivos, les puse mi IP, PUERTO,y CLAVE.

espero me ayuden con mi problema lo mas antes posible.. Muchas Gracias

Última edición por josek; 04/11/2010 a las 20:16

Etiquetas: fsockopen, maestros
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 11:52.