Ver Mensaje Individual
  #1 (permalink)  
Antiguo 13/07/2008, 09:41
Avatar de _eNGeLs_
_eNGeLs_
 
Fecha de Ingreso: noviembre-2007
Ubicación: CDE, Paraguay
Mensajes: 278
Antigüedad: 16 años, 5 meses
Puntos: 4
Pregunta Procesador de feeds rss

salu2!
tengo esta funcion que extrae el ultimo feed de una pag RSS que le pase..

Código PHP:
function CargarXML($ruta_fichero)
{
    
$contenido "";
    if(
$da fopen($ruta_fichero,"r"))
    {
        while (
$auxfgets($da,1024))
        {
            
$contenido.=$aux;
        }
    
fclose($da);
    }
    else
    {
        echo 
"Error: no se ha podido leer el archivo <strong>$ruta_fichero</strong>";
        exit;
    }
    
    
$tagnames = array ("title","description","link");
    
    if (!
$xml domxml_open_mem($contenido))
    {
        echo 
"Ha ocurrido un error al procesar el documento<strong> \"$ruta_fichero\"</strong> a XML <br>";
        exit;
    }
    else
    {
        
$raiz $xml->document_element();
        
$tam=sizeof($tagnames);
        for(
$i=0$i<$tam$i++)
        {
            
$nodo $raiz->get_elements_by_tagname($tagnames[$i]);
            
$j=0;
            foreach (
$nodo as $etiqueta)
            {
                
$matriz[$j][$tagnames[$i]]=$etiqueta->get_content();
                
$j++;
            }
        }
            return 
$matriz;
    }

ahora.. lo que necesito es que si el link del RSS que le paso no tiene feeds, que guarde en una variable tipo(error='si') y que no continue intentando procesar el feed 'q no existe'. Sin usar exit(), ya que me para todo el script..

Si alguien me puede ayudar.. le estaria muy agradecido
__________________