Hey I wrote this to grab get a FB page feed and output it to a site.
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?
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)
So… its a compression issue? What does it mean, and what can I do?
Try this, it will work.
Short, sweet, simple.