RSS to HTML

Discussion in 'Cloaking and Content Generators' started by ScottHughes, Dec 22, 2006.

  1. ScottHughes

    ScottHughes Registered Member

    Joined:
    Dec 22, 2006
    Messages:
    89
    Likes Received:
    2
    How do you get RSS feeds to HTML? I know how it's done, but I need a script that can do this. I know there are free ones out there, because it's not that complex. Where's a good free RSS to HTML script for free?
     
  2. hades

    hades Newbie

    Joined:
    Dec 19, 2006
    Messages:
    42
    Likes Received:
    71
    you send me a pm !
     
  3. kevmus

    kevmus Newbie

    Joined:
    Jan 14, 2007
    Messages:
    14
    Likes Received:
    2
    Theres no way to get RSS to HTML, you have to try for RSS to PHP to HTML :)
     
  4. Fusion

    Fusion Newbie

    Joined:
    Dec 8, 2006
    Messages:
    14
    Likes Received:
    2
    Since RSS is XML-based, I think that using XSLT (XSL transformatgion) with a stylesheet that parses the feed should work pretty well to generate valid XHTML.
    No need for PHP or any other programing language.
     
  5. phenomgfx

    phenomgfx Newbie

    Joined:
    Feb 6, 2007
    Messages:
    10
    Likes Received:
    3
    Yea i doubt thats possible well not yet, nothing is really impossible.
     
  6. nonim

    nonim Newbie

    Joined:
    Feb 4, 2007
    Messages:
    14
    Likes Received:
    1
    u mass to have easy parser, this is one to google news, U mass change Keyword

    Code:
    <?php
    set_time_limit(0);
    
    $file = "http://news.google.com/news?sourceid=navclient&ie=UTF-8&rls=GGLG,GGLG:2005-22,GGLG:en&q=KEYWORD&output=rss";
    
    $rss_channel = array();
    $currently_writing = "";
    $main = "";
    $item_counter = 0;
    
    function startElement($parser, $name, $attrs) {
       	global $rss_channel, $currently_writing, $main;
       	switch($name) {
       		case "RSS":
       		case "RDF:RDF":
       		case "ITEMS":
       			$currently_writing = "";
       			break;
       		case "CHANNEL":
       			$main = "CHANNEL";
       			break;
       		case "IMAGE":
       			$main = "IMAGE";
       			$rss_channel["IMAGE"] = array();
       			break;
       		case "ITEM":
       			$main = "ITEMS";
       			break;
       		default:
       			$currently_writing = $name;
       			break;
       	}
    }
    
    function endElement($parser, $name) {
       	global $rss_channel, $currently_writing, $item_counter;
       	$currently_writing = "";
       	if ($name == "ITEM") {
       		$item_counter++;
       	}
    }
    
    function characterData($parser, $data) {
    	global $rss_channel, $currently_writing, $main, $item_counter;
    	if ($currently_writing != "") {
    		switch($main) {
    			case "CHANNEL":
    				if (isset($rss_channel[$currently_writing])) {
    					$rss_channel[$currently_writing] .= $data;
    				} else {
    					$rss_channel[$currently_writing] = $data;
    				}
    				break;
    			case "IMAGE":
    				if (isset($rss_channel[$main][$currently_writing])) {
    					$rss_channel[$main][$currently_writing] .= $data;
    				} else {
    					$rss_channel[$main][$currently_writing] = $data;
    				}
    				break;
    			case "ITEMS":
    				if (isset($rss_channel[$main][$item_counter][$currently_writing])) {
    					$rss_channel[$main][$item_counter][$currently_writing] .= $data;
    				} else {
    					$rss_channel[$main][$item_counter][$currently_writing] = $data;
    				}
    				break;
    		}
    	}
    }
    
    $xml_parser = xml_parser_create();
    xml_set_element_handler($xml_parser, "startElement", "endElement");
    xml_set_character_data_handler($xml_parser, "characterData");
    if (!($fp = fopen($file, "r"))) {
    	die("could not open XML input");
    }
    
    while ($data = fread($fp, 4096)) {
    	if (!xml_parse($xml_parser, $data, feof($fp))) {
    		die(sprintf("XML error: %s at line %d",
    					xml_error_string(xml_get_error_code($xml_parser)),
    					xml_get_current_line_number($xml_parser)));
    	}
    }
    xml_parser_free($xml_parser);
    
    // output HTML
    // print ("<div class=\"channelname\">" . $rss_channel["TITLE"] . "</div>"); 
    
    if (isset($rss_channel["ITEMS"])) {
    	if (count($rss_channel["ITEMS"]) > 0) {
    		for($i = 0;$i < count($rss_channel["ITEMS"]);$i++) {
    			if (isset($rss_channel["ITEMS"][$i]["LINK"])) {
    			print ("\n<div class=\"itemtitle\"><a href=\"" . "go.php?url=" . $rss_channel["ITEMS"][$i]["LINK"] . "\">" . $rss_channel["ITEMS"][$i]["TITLE"] . "</a></div>");
    			} else {
    			print ("\n<div class=\"itemtitle\">" . $rss_channel["ITEMS"][$i]["TITLE"] . "</div>");
    			}
    			 print ("<div class=\"itemdescription\">" . $rss_channel["ITEMS"][$i]["DESCRIPTION"] . "</div><br />"); 		}
    	} else {
    		print ("<b>There are no articles in this feed.</b>");
    	}
    }
    
    ?>
    
     
  7. jcooper66

    jcooper66 Newbie

    Joined:
    Mar 15, 2007
    Messages:
    20
    Likes Received:
    0
    magpierss.sourceforge.net
     
  8. Djingel

    Djingel Junior Member

    Joined:
    Apr 9, 2007
    Messages:
    150
    Likes Received:
    84
    The script you gave there is working excellent, thank you!
    Are there more scripts like that?
     
  9. busin3ss

    busin3ss Junior Member

    Joined:
    Mar 30, 2007
    Messages:
    144
    Likes Received:
    40
    Nonim did you coded that script?
     
  10. Beef

    Beef Newbie

    Joined:
    Apr 23, 2007
    Messages:
    13
    Likes Received:
    0
    thanks alot!
     
  11. warlock77

    warlock77 Newbie

    Joined:
    Mar 16, 2007
    Messages:
    21
    Likes Received:
    6
    Thanks for help
     
  12. BlackSeo

    BlackSeo Regular Member

    Joined:
    Feb 18, 2007
    Messages:
    253
    Likes Received:
    326
    Occupation:
    Programmer, Crypto-investor
    Location:
    In BlackHat World
    nonim,
    great script,do you have more scripts in your arsenal?

    BS
     
  13. web_i

    web_i Junior Member

    Joined:
    Dec 5, 2006
    Messages:
    187
    Likes Received:
    60
    Occupation:
    Self Employed
    Location:
    USA
    have you looked here :

    http://w w w.rss2html.com/
     
  14. maribge

    maribge Junior Member

    Joined:
    May 6, 2007
    Messages:
    106
    Likes Received:
    11
    I have coded rss2html script on my own and it has lots of cool features.