首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >SimplePie文档解析错误

SimplePie文档解析错误
EN

Stack Overflow用户
提问于 2015-04-21 11:47:37
回答 1查看 376关注 0票数 0

我试图在laravel应用程序中实现Simplepie来解析提要,但是当我这样做时,我得到了以下错误:

此XML文档无效,可能是由于无效字符造成的。XML错误:格式不正确(无效令牌),位于第1行第1列。

提要是这样的:https://www-304.ibm.com/connections/blogs/roller-ui/rendering/feed/PSIRT/entries/atom?search=cn4093&t=entry&f=all&lang=en_us,它在演示应用程序中运行得很好,但是在本地失败了。

在这里,我所做的是:

代码语言:javascript
复制
$feed = new SimplePie();
$feed->set_feed_url("https://www-304.ibm.com/connections/blogs/roller-ui/rendering/feed/PSIRT/entries/atom?search=cn4093&t=entry&f=all&lang=en_us");
$feed->enable_cache(true);
$feed->set_cache_location(storage_path().'/cache');
$feed->set_cache_duration(60*60*12);
$feed->set_output_encoding('utf-8');
$feed->force_feed(true)
$feed->init();

有人能帮我吗?

EN

回答 1

Stack Overflow用户

发布于 2015-04-21 12:25:14

问题似乎是因为您试图加载的SSL (https)连接。请阅读此:https://github.com/simplepie/simplepie/issues/236

它包括使用cURL下载RSS的修复程序,并将其结果包含到SimplePie类中进行解析。

更新:阅读manishbhatias于2011年7月20日发表的评论,网址:https://github.com/simplepie/simplepie/issues/82

和你分享同样的问题。他认为这与SimplePie用来在URL中对参数进行urlencode的方法有关。您可以创建一个代理PHP脚本,并查看它是否解决了问题。

<?php echo file_get_contents('https://www-304.ibm.com/connections/blogs/roller-ui/rendering/feed/PSIRT/entries/atom?search=cn4093&t=entry&f=all&lang=en_us'); ?>

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/29771373

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档