Hi,
I use RSSlib to display news for a RSS feed on my homepage. The code works when Im working on localhost, but fails every time when I go online, onto my server.
The error is:
Warning: DOMDocument::load() [domdocument.load]: Document is empty in [RSS Location], line: 1 in rsslib.php on line 53
This is the code here , up to line 53:
<?php
$RSS_Content = array();
function RSS_Tags($item, $type) {
$y = array();
$tnl = $item->getElementsByTagName("title");
$tnl = $tnl->item(0);
$title = $tnl->firstChild->textContent;
$tnl = $item->getElementsByTagName("link");
$tnl = $tnl->item(0);
$link = $tnl->firstChild->textContent;
$tnl = $item->getElementsByTagName("pubDate");
$tnl = $tnl->item(0);
$date = $tnl->firstChild->textContent;
$tnl = $item->getElementsByTagName("description");
$tnl = $tnl->item(0);
$description = $tnl->firstChild->textContent;
$y["title"] = $title;
$y["link"] = $link;
$y["date"] = $date;
$y["description"] = $description;
$y["type"] = $type;
return $y;
}
function RSS_Channel($channel) {
global $RSS_Content;
$items = $channel->getElementsByTagName("item");
// Processing channel
$y = RSS_Tags($channel, 0); // get description of channel, type 0
array_push($RSS_Content, $y);
// Processing articles
foreach($items as $item) {
$y = RSS_Tags($item, 1); // get description of article, type 1
array_push($RSS_Content, $y);
}
}
function RSS_Retrieve($url) {
global $RSS_Content;
$doc = new DOMDocument();
$doc->load($url);
...
RSS_Retrieve() is called later on with the URL of the RSS feed.
What would cause this to work offline on a personal server, but fail online?