hello, I would like to show RSS feed from a website say http://www.haxor.com on the front page of my website. Can some one help me in accomplishing this?
There is a tutorial on this for PHP here: http://articles.techrepublic.com.com/5100-10878_11-5109834.html
hey thanks for the reply, but that is not going to serve my purpose and implementing that will be too difficult. Ther must be some easier way. if any one has any other suggestion, please help me.
If you convert your web page to .asp extension and use this simple all in one ASP Script. Simple Replace the 'URLToRSS with a full feed address. I have set this code up so it pulls just the title of posts into bullet points. You can add in the other variables to add more information etc. Let me know if you need any more help configuring. :
Too hard? It looks easier than the ASP version Just copy and paste this code change only 1 line, the part which says "YOURFEEDURLHERE" It also definitely serves your purpose. It takes an RSS feed from another website and prints it in HTML on your web page. Listing C: Parsing the RSS file <?php $GLOBALS['title'] = false; $GLOBALS['link'] = false; $GLOBALS['description'] = false; $GLOBALS['titletext'] = null; $GLOBALS['linktext'] = null; $GLOBALS['desctext'] = null; function startElement( $parser, $tagName, $attrs ) { switch( $tagName ) { case 'TITLE': $GLOBALS['title'] = true; break; case 'LINK': $GLOBALS['link'] = true; break; case 'DESCRIPTION': $GLOBALS['description'] = true; break; } } function endElement( $parser, $tagName ) { switch( $tagName ) { case 'TITLE': echo "<p><b>" . $GLOBALS['titletext'] . "</b><br/>"; $GLOBALS['title'] = false; $GLOBALS['titletext'] = ""; break; case 'LINK': echo "Link: <a href=\"". $GLOBALS['linktext'] . "\">" . $GLOBALS['linktext'] . "</a><br/>"; $GLOBALS['link'] = false; $GLOBALS['linktext'] = ""; break; case 'DESCRIPTION': echo "Desc: " . $GLOBALS['desctext'] . "</p>"; $GLOBALS['description'] = false; $GLOBALS['desctext'] = ""; break; } } function charElement( $parser, $text ) { if( $GLOBALS['title'] == true ) { $GLOBALS['titletext'] .= htmlspecialchars( trim($text) ); } else if( $GLOBALS['link'] == true ) { $GLOBALS['linktext'] .= trim( $text ); } else if( $GLOBALS['description'] == true ) { $GLOBALS['desctext'] .= htmlspecialchars( trim( $text ) ); } } $xmlParser = xml_parser_create(); xml_set_element_handler( $xmlParser, "startElement", "endElement" ); xml_set_character_data_handler( $xmlParser, "charElement" ); $fp = fopen( "http://YOURFEEDURLHERE", "r" ) or die( "Cannot read RSS data file." ); while( $data = fread( $fp, 4096 ) ) { xml_parse( $xmlParser, $data, feof( $fp ) ); } fclose( $fp ); xml_parser_free( $xmlParser ); ?> Code (markup):
I've used Magpie RSS [http://magpierss.sourceforge.net/] in the past with good results. Unlike other php XML parsers, it doesn't break when you feed it unusual (invalid) XML files.
Likewise, except I found magpie stopped working for me. However, by submitting my feed to Feedburner the rss started working again. So if you use magpie, I recommend using Feedburner aswell.
If you go to itde.vccs.edu/rss2js/build.php it will convert the feed address into the code to place in your web page.
@ Edetroiter U r right, beside ur link I found a couple of other links and infact these are really the best solution. I hv also bough the CARP Evolution that converts any RSS feed and display it as content with images and video on ur webpage. This is real good man. let me know if any one wish to buy it.
There is also the excellent lastRSS rss parser. It's simple to setup, and very light. I use it on a ton of sites and it's never let me down once. http://lastrss.oslab.net/