Welcome to the MacNN Forums.

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

You are here: MacNN Forums > Software - Troubleshooting and Discussion > Developer Center > RSS bug

RSS bug
Thread Tools
Mac Elite
Join Date: Mar 2002
Location: Clogland
Status: Offline
Reply With Quote
Aug 3, 2005, 04:46 AM
 
/// OK I found it, there were two different feeds, and I was ftp'ing to the wrong file Do'h, will leave the post for prosperity



Wierd problem, I'm accessing a rss feed, but my code is showing old info.

The feed comes from here.
http://feeds.feedburner.com/medicalfacts
The rss link is this
http://feeds.feedburner.com/EhealthMedicalfactsnl

If I use an rss reader I get the up to date info, but not as a html page as shown here

http://scraf.com/rss/test.php

For what it's worth, here is the code (straight out of the Php Cookbook)

[php]
<?php
class pc_RSS_item{

var $title = '';
var $description = '';
var $link = '';
var $pubDate = '';

function display(){
$this->description = str_replace ( '&amp;', '&', $this->description );
$this->description = str_replace ( '&euml;', 'ë', $this->description );
$this->description = str_replace ( '&rsquo;', '\'', $this->description );
$this->description = str_replace ( '[image1_left]', '', $this->description );
$this->description = str_replace ( '&euro;', '€', $this->description );
$this->description = str_replace ( '&iuml;', 'ï', $this->description );
$this->title = str_replace ( '&amp;', '&', $this->title );
$this->title = str_replace ( '&euml;', 'ë', $this->title );
$this->title = str_replace ( '&rsquo;', '\'', $this->title );
$this->title = str_replace ( '[image1_left]', '', $this->title );
$this->title = str_replace ( '&euro;', '€', $this->title );
$this->title = str_replace ( '&iuml;', 'ï', $this->title );
$this->pubDate = substr_replace ( $this->pubDate, '',0,4);
$this->pubDate = substr_replace ( $this->pubDate, '',12,18);
printf('<p><a href="%s">%s</a><br /></p><div id="datum">%s</div><p>%s</p>',
$this->link,htmlspecialchars($this->title),$this->pubDate,
htmlspecialchars($this->description));
}
}

class pc_RSS_parser{
var $tag;
var $item;

function start_element($parser, $tag, $attributes){
if('item' == $tag){
$this->item = new pc_RSS_item;
}elseif(!empty($this->item)){
$this->tag = $tag;
}
}
function end_element($parser, $tag){
if('item' == $tag){
$this->item->display();
unset($this->item);
}
}
function character_data($parser, $data){
if(!empty($this->item)){
if(isset($this->item->{$this->tag})){
$this->item->{$this->tag} .= trim($data);
}
}
}
}

$xml = xml_parser_create();
$rss = new pc_RSS_parser;

xml_set_object($xml, $rss);
xml_set_element_handler($xml, 'start_element', 'end_element');
xml_set_character_data_handler($xml, 'character_data');
xml_parser_set_option($xml, XML_OPTION_CASE_FOLDING, false);

// HERE I"M ACCESSING THE FEED

$feed = 'http://feeds.feedburner.com/EhealthMedicalfactsnl';

$fp = fopen($feed, 'r') or die("Not getting the rss feed");
while($data = fread($fp, 4096)){
xml_parse($xml, $data, feof($fp)) or die("Parse ain't working today, sir");
}
fclose($fp);

xml_parser_free($xml);
?>
[/php]

Anyone have an idea as to what is happenning?
(Last edited by skalie; Aug 3, 2005 at 05:09 AM. )
     
   
Thread Tools
Forum Links
Forum Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Top
Privacy Policy
All times are GMT -5. The time now is 09:24 AM.
All contents of these forums © 1995-2011 MacNN. All rights reserved.
Branding + Design: www.gesamtbild.com
vBulletin v.3.8.7 © 2000-2011, Jelsoft Enterprises Ltd., Content Relevant URLs by vBSEO 3.3.2