我有下面的代码在一个XML文件中读取:使用simplexml_load_file问题
$xml2 = simplexml_load_file('http://www.facebook.com/feeds/page.php?format=rss20&id=334704593230758');
$item = $xml2->channel->item;
我正在以下回到我的源代码:
<b>Warning</b>: simplexml_load_file() [<a href='function.simplexml-load-file'>function.simplexml-load-file</a>]: http://www.facebook.com/feeds/page.php?format=rss20&id=334704593230758:11: parser error : xmlParseEntityRef: no name in <b>/home/content/49/8644249/html/test/_inc/footer.php</b> on line <b>110</b><br />
继续上就像那10条线一样。 xml代码有问题吗?
快速谷歌(你可以做)显示,这意味着该文件中的未编码符号(所有流浪'&'应该是'&') 。看起来Facebook不会正确输出html_entities()d RSS feed。 – 2012-07-23 21:44:12
Ooooh有人在FB会得到一个屁股踢...虽然我正在检查当前由该URL返回的XML,并没有这样的问题 - 它有几个正确编码的实体。 – DaveRandom 2012-07-23 21:46:05