我正在从以下 URL 解析 RSS 提要:
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说这是一个很好的提要。
如何让 PHP 的 XML 解析器解决此错误?
编辑:看起来他们正在根据用户代理将此提要重定向到另一个位置。我的 PHP 脚本没有得到正确的提要。