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.

简短,甜美,简单。

更多相关文章

  1. 为什么cron工作不是从浏览器工作,但从终端工作完美
  2. 通过SSH将MySQL绑定到本地端口——在控制台工作,而不是通过Mac OS
  3. 使用PHP将XML Spreadsheet工作簿解析为JSON
  4. Angular Js $ http.get CORS问题 - 在Jquery中工作
  5. php是如何工作的
  6. imagecreatetruecolor()在symfony中不起作用,但如果作为php脚本运行
  7. 请问做PHP相关工作是不是基本都要懂前端才行?
  8. PHP / Ajax:如何在成功登录后启动会话(剩余代码工作)
  9. 将csv文件保存到现有文件,但在新工作表和重命名工作表中

随机推荐

  1. 这三个难的PHP知识点,你都会了吗?
  2. PHP使用Screw把源代码加密
  3. PHP高并发和大流量的解决方案
  4. Mac下使用php的error_log()函数发送邮件
  5. PHP按一定比例压缩图片(保持清晰度)
  6. 详解PHP中const和define的区别
  7. 关于 PHP 开发中遇到的 error
  8. PHP 实现精确统计在线人数功能
  9. 《2019年小米春季上海 PHP 实习生招聘面
  10. PHP 数组占用内存分析