Pregunta

Estoy analizando una fuente RSS de la siguiente URL:

http://rss.sciam.com/ScientificAmerican-Global?format=xml

// $xml_text is filled with the contents read from the URL
$xml_parser = xml_parser_create();
$res = xml_parse($xml_parser, $xml_text);

if (!$res) {
  $error =
    xml_error_string(xml_get_error_code($xml_parser)).
    " at line ".
    xml_get_current_line_number($xml_parser);
}

// $error contains: "SYSTEM or PUBLIC, the URI is missing at line 1"

FeedValidator.org dice que esta es una buena fuente.

¿Cómo puedo hacer que el analizador XML de PHP evite este error?

EDIT : parece que están redirigiendo este feed a otra ubicación según el agente de usuario. Mi script PHP no está recibiendo la fuente correcta.

¿Fue útil?

Solución

El código funciona para mí, debes tener el texto incorrecto.

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top