PHP rss阅读器不起作用
Hey I wrote this to grab get a FB page feed and output it to a site.
嘿,我写这篇文章来获取FB页面提要并将其输出到网站。
It works just fine from my localhost, but not when placed it on the server. It's just blank.
它从我的本地主机可以正常工作,但不能放在服务器上。它只是空白。
<?php
$xml_url = "http://fbrss.com/f/7f823b5ba0557decbd324199136326ac_7LpQh7MAJ22MISS1omjI.xml";
$xml = simplexml_load_file($xml_url);
$json = json_encode($xml);
$objects = json_decode($json,TRUE);
$object = $objects;
$i=0;
foreach ($object as $items) {
$json = json_encode($items);
$objects = json_decode($json,TRUE);
$object = $objects;
$i=0;
foreach ($object as $items) {
$item[$i] = $items;
$i++;
}
}
$entries = $item[5];
foreach ($entries as $entry) {
echo '<a href="'.$entry["guid"].'">', substr($entry["title"], 0, 50), '...</a><br /><span>', substr($entry["pubDate"], 4, 18),'</span><br /><hr /><br />';
}
?>
My questions are 1) why doent it work live, and 2) is there a better way to do this?
我的问题是1)为什么它会在现场工作,2)有更好的方法吗?
UPDATE
UPDATE
Ok I have pulled the error log, and this is what I am getting:
好的,我已经删除了错误日志,这就是我得到的:
[Mon Jun 25 03:08:20 2012][debug] mod_deflate.c(615): [client 74.192.47.34] Zlib: Compressed 0 to 2 : URL /*/*/xmlFeed.php (* added by me)
[Mon Jun 25 03:08:20 2012] [debug] mod_deflate.c(615):[client 74.192.47.34] Zlib:压缩0到2:URL /*/*/xmlFeed.php(*由我添加)
So... its a compression issue? What does it mean, and what can I do?
那么...它是一个压缩问题?它是什么意思,我该怎么办?
1 个解决方案
#1
1
Try this, it will work.
试试这个,它会起作用。
<?php
$xml_url = "http://fbrss.com/f/7f823b5ba0557decbd324199136326ac_7LpQh7MAJ22MISS1omjI.xml";
$xml = simplexml_load_file($xml_url);
foreach ($xml->channel->item as $item) {
echo '<a href="'.$item->guid.'">', substr($item->title, 0, 50), '...</a><br /><span>', substr($item->pubDate, 4, 18),'</span><br /><hr /><br />';
}
?>
Short, sweet, simple.
简短,甜美,简单。
更多相关文章
- 为什么cron工作不是从浏览器工作,但从终端工作完美
- 通过SSH将MySQL绑定到本地端口——在控制台工作,而不是通过Mac OS
- 使用PHP将XML Spreadsheet工作簿解析为JSON
- Angular Js $ http.get CORS问题 - 在Jquery中工作
- php是如何工作的
- imagecreatetruecolor()在symfony中不起作用,但如果作为php脚本运行
- 请问做PHP相关工作是不是基本都要懂前端才行?
- PHP / Ajax:如何在成功登录后启动会话(剩余代码工作)
- 将csv文件保存到现有文件,但在新工作表和重命名工作表中