how are u guys doing, ive opened a website, and I was looking to use rss feeds from multiple news sources to display on a single page, thats the whole point of my website, its to make it convenient for people to get news from multiple news sources http://www.cricketnewsworld.com i looked around the web and looked at some scripts, packages such as carp where they charge but then i came around ur script, its perfect for me, the only problem is i get an error when I try to put more then one feed on my page I just copy and pasted ur script 3 times with different links, only the first one showed up im guessing its not desgined to function like that, since the variables are repeated Fatal error: Cannot redeclare startelement() (previously declared in /home2/cricketg/public_html/cricketnewsworld/index.php:241) in /home2/cricketg/public_html/cricketnewsworld/index.php on line 355 thats the errror it shows, as you can see on my website there if you could shed some insight into this problem id be greatfull thanks
very powerful thanks I need help with rss Im offering placement on a huge traffic building site comin out soon anyone up for link exchange and free advertisement let know I need RSS feed in the site please my sites domain is ewww.trafficbuilderssite.com it isn't online yet parked until it is powerfully equipet
Thanks a lot for this helpful thread. I hope this thread will definitely help me out. I will be back soon
i tried both straight and rotating codes and they work great! this is so simple thank you so much for sharing!!! i put it in a css styled div and it looks great already. like this: <style> .feed {width:500px; font:11pt arial;} .feed a{color:green} </style> <div class="feed"> code here </div> Code (markup): HOWEVER. its having trouble reading some ascii characters. is there a php fix out there that would help this code read correctly for a browser? PLUS. how would you control the amount of posts shown. can you set how many characters to show? ALSO. i want to pull in the images with it. is it hard to do? THANKS! Trisha
Greetings all member here. I am a newbie for trying to read RSS into my website. But i face a problem when i upload to my Linux hosting server. You can see error here http://www.it-smart.biz/news/ Error: XML error: mismatched tag at line 20 But in my localhost testing is running well. So i asked my server they said that all functions are enabled. They ask me which function that we need to use? So they will enable more. Anyone face error like me? How to fix it?
Is there any way of it changing to the next item in the feed after a set period of time? At the moment it only displays a list for me, but I want just one line to refresh with different items each time.
I thought you would like a variation of this code. I make the feeds title and content shorter and added some formatting features. Change while ($int != 2){ === the number "2" to get more and less feeds. This feed gets 5 RSS links. It's great for a side bar. <?php $insideitem = false; $tag = ""; $title = ""; $description = ""; $link = ""; function startElement($parser, $name, $attrs) { global $insideitem, $tag, $title, $description, $link; if ($insideitem) { $tag = $name; } elseif ($name == "ITEM") { $insideitem = true; } } function endElement($parser, $name) { global $insideitem, $tag, $title, $description, $link; if ($name == "ITEM") { printf("<dt><h3 class=\"h3\"><a href='%s'>%s</a></h3></dt>", trim($link),htmlspecialchars(substr($title,0,95) . "...")); printf("<dt><p>" . htmlspecialchars(substr($description,0,250)) . "...</p></dt>",h); $title = ""; $description = ""; $link = ""; $insideitem = false; } } function characterData($parser, $data) { global $insideitem, $tag, $title, $description, $link; if ($insideitem) { switch ($tag) { case "TITLE": $title .= $data; break; case "DESCRIPTION": $description .= $data; break; case "LINK": $link .= $data; break; } } } $xml_parser = xml_parser_create(); xml_set_element_handler($xml_parser, "startElement", "endElement"); xml_set_character_data_handler($xml_parser, "characterData"); $fp = fopen("http://rssfeeds.webmd.com/rss/rss.aspx?cid=1010","r") or die("Error reading RSS data."); $int = 0; while ($int != 2){ $data = fread($fp, 4096); xml_parse($xml_parser, $data, feof($fp)) or die(sprintf("XML error: %s at line %d", xml_error_string(xml_get_error_code($xml_parser)), xml_get_current_line_number($xml_parser))); $int++; } fclose($fp); xml_parser_free($xml_parser); ?> PHP: