我试图在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,它在演示应用程序中运行得很好,但是在本地失败了。
在这里,我所做的是:
$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();有人能帮我吗?
发布于 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'); ?>
https://stackoverflow.com/questions/29771373
复制相似问题