![Negando](http://static.forosdelweb.com/fdwtheme/images/smilies/negar.gif)
Aqui el codigo:
Código PHP:
<?
// parser de rss
// obtenemos el rss desde el sitio de zonaphp :)
if(!($fp = fopen("http://steamid.com/ircbot.php?qvalue=0:0:205893", "r")))
{
die("No puedo abrir el archivo!");
}
$rss = "";
while(!feof($fp))
{
$rss .= fread($fp, 4096);
}
fclose($fp);
// inicializamos los auxiliares
$contenido = "";
$tag_actual = "";
$en_item = false;
$item = 0;
// inicializamos arrays
$items = Array();
// creamos el parser
$parser = xml_parser_create();
// definimos los "handlers"
xml_set_element_handler($parser, "tag_abre", "tag_cierra");
xml_set_character_data_handler($parser, "tag_contenido");
// declaramos las funciones
function tag_abre($parser, $nombre, $atributos)
{
global $tag_actual, $en_item;
$tag_actual = $nombre;
switch($nombre)
{
case "RESULT":
$en_item = true;
break;
}
}
function tag_contenido($parser, $valor)
{
global $contenido;
$contenido .= $valor;
}
function tag_cierra($parser, $nombre)
{
global $tag_actual, $contenido, $item, $en_item,$items;
$contenido = trim($contenido);
switch($nombre)
{
case "PLAYER_STEAMID":
if($en_item) {
$items[$item]["PLAYER_STEAMID"] = $contenido;
}
break;
case "TEAM_LEAGUE":
if($en_item) {
$items[$item]["TEAM_LEAGUE"] = $contenido;
}
break;
case "TEAM_NAME":
if($en_item) {
$items[$item]["TEAM_NAME"] = $contenido;
}
break;
case "TEAM_IRC":
if($en_item) {
$items[$item]["TEAM_IRC"] = $contenido;
}
break;
case "PLAYER_NAME":
if($en_item) {
$items[$item]["PLAYER_NAME"] = $contenido;
}
break;
}
$tag_actual = "";
$contenido = "";
}
// procedemos a procesar el archivo, en caso de error
// lo indicamos y terminamos
if(!xml_parse($parser, $rss, true))
{
die("Error en la linea ".
xml_get_current_line_number($parser).
": ".xml_error_string(xml_get_error_code($parser)));
}
// destruimos el parser
xml_parser_free($parser);
print $item["PLAYER_STEAMID"];
print $item["TEAM_LEAGUE"];
print $item["TEAM_NAME"];
print $item["TEAM_IRC"];
print $item["PLAYER_NAME"];
?>
![lloron](http://static.forosdelweb.com/fdwtheme/images/smilies/chillando.png)
Alguna idea?
![Adios](http://static.forosdelweb.com/fdwtheme/images/smilies/adios.gif)