XML解析错误:SYSTEM或者PUBLIC,缺少URI
时间:2020-03-06 14:56:20 来源:igfitidea点击:
我正在从以下URL解析RSS feed:
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脚本未获得正确的提要。
解决方案
该代码对我有用,我们一定在输入错误的文本。