Twitter API simplexml_load_string 停止工作
今天早上,我用于 Twitter OAuth 发布的 PHP 脚本停止工作。我怀疑 Twitter 为返回的字符串添加了一些行。任何人都可以帮助如何调试这个。
谢谢
Warning: simplexml_load_string() [function.simplexml-load-string]: Entity: line 74:
parser error : Entity 'copy' not defined in /nfs/c05/h01/mnt/82363/domains/html/c/cron.m.php on line 429
Warning: simplexml_load_string() [function.simplexml-load-string]:
<li class="first">© 2011 Twitter</li> in /nfs/c05/h01/mnt/82363/domains/html/c/cron.m.php on line 429
Warning: simplexml_load_string() [function.simplexml-load-string]: ^ in /nfs/c05/h01/mnt/82363/domains/html/c/cron.m.php on line 429
This morning my PHP script, for Twitter OAuth posting, stopped working. I suspect that Twitter added some rows for the returned string. Can anyone help how to debug this.
Thanks
Warning: simplexml_load_string() [function.simplexml-load-string]: Entity: line 74:
parser error : Entity 'copy' not defined in /nfs/c05/h01/mnt/82363/domains/html/c/cron.m.php on line 429
Warning: simplexml_load_string() [function.simplexml-load-string]:
<li class="first">© 2011 Twitter</li> in /nfs/c05/h01/mnt/82363/domains/html/c/cron.m.php on line 429
Warning: simplexml_load_string() [function.simplexml-load-string]: ^ in /nfs/c05/h01/mnt/82363/domains/html/c/cron.m.php on line 429
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
XML 包含 HTML 实体。
©
在 XML 中无效。作为解决方法,您可以在将文档移交给 SimpleXML 之前对其进行预过滤:The XML contains HTML entities.
©
is not valid in XML. As a workaround you could pre-filter the document before handing it over to SimpleXML:此代码适用于 UTF-8 字符串 xml 数据。
$xml = mb_strtr($xml, array_flip(array_diff(get_html_translation_table(HTML_ENTITIES),get_html_translation_table(HTML_SPECIALCHARS))));
$xml = simplexml_load_string($xml);
This code works for UTF-8 string xml data.
$xml = mb_strtr($xml, array_flip(array_diff(get_html_translation_table(HTML_ENTITIES),get_html_translation_table(HTML_SPECIALCHARS))));
$xml = simplexml_load_string($xml);
echo 该字符串并查找对 xml 文件所做的新更改,
它们可能添加了命名空间。
echo the string and look for the new changes that were made to the xml file,
It's possible that they added a namespace.