I am having problems loading an [B]external RSS feed
I checked my php settings and noticed that [I]allow_url_fopen [B]enabled
I’ve searched these forums and I google’d it quite extensively, but I haven’t found a similar case example and resolution. Any help you can provide would be greatly appreciated!
Here’s the code:
[code=php]
// – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – –
// XML Feed
function processFeed($rss,$type) {
# Initiate variables
$_GET[‘newsoutput’] = “”;
$xml = “”;
if(fopen($rss, “r”)) {
$xml = simplexml_load_file($rss);
} else {
echo ‘<p>Could not open file!</p>’;
}
$_GET[‘newsoutput’] = “<ul class=”standard”>”;
switch ($type) {
case “blog”:
foreach ($xml->channel->item as $item) {
for ($i = 0; $i < 2; $i++) {
foreach ($item[$i]->pubDate as $date) {
#$date = str_replace(“+0000”, “”, $date);
$date = substr($date, 0, -15);
$_GET[‘newsoutput’] .= “<li><strong>$date</strong><br />”;
}
foreach ($item[$i]->link as $link) {
$_GET[‘newsoutput’] .= “<a href=”$link”>”;
}
foreach ($item[$i]->title as $title) {
$_GET[‘newsoutput’] .= “$title</a></li>”;
}
}
}
break;
# End case “blog”
case “digg”:
foreach ($xml->channel->item as $item) {
for ($i = 0; $i < 2; $i++) {
foreach ($item[$i]->pubDate as $date) {
$date = substr($date, 0, -15);
$_GET[‘newsoutput’] .= “<li><strong>$date</strong><br />”;
}
foreach ($item[$i]->link as $link) {
$_GET[‘newsoutput’] .= “<a href=”$link”>”;
}
foreach ($item[$i]->title as $title) {
$_GET[‘newsoutput’] .= “$title</a></li>”;
}
}
}
break;
# End case “digg”
} # End Switch
$_GET[‘newsoutput’] .= “</ul>”;
echo $_GET[‘newsoutput’];
}
and the initiated function:
[code=php]
processFeed(“http://www.digg.com/users/username/history.rss”,”digg”);