It's just a news feed that lists the news or sporting results etc etc into a java scroller type thing, to install it I think it's just a copy and paste job.
If you are new to domains and looking to buy, sell and learn about domains then you have come to the right place. DNForum is the largest domain name community on the internet and continues to grow every day. There are over 105,000 domainers on DNForum doing everything from buying domains, selling domains, learning about domains and discussing domains. Take a minute and Register.
Register Today on DNForum IT'S FREE!Anyone know where I can get a complete resource as to what an RSS feed is (I know a little, not enough), and how one can incorporate it into a site...etc...?
I gogled it, but too much info, and not a how to etc...
Much appreciated.
Seek... And you shall Find
It's just a news feed that lists the news or sporting results etc etc into a java scroller type thing, to install it I think it's just a copy and paste job.
mmmm, in google I get all kind of results.
Seek... And you shall Find
An RSS feed is supposed to be an XML file that meets the RSS dtd. Problem is it developed more ad hoc then it should have so there are more then one DTD for RSS that are not really compatible. So many just use regexps to parse them. ATOM is suppoed to be the format to fix this. I think that the concept itself it flawed and should be replaced.
In any case, what you need is a snippet of code to transform the rss/xml to html or whatever output format you desire. If you can't find something by tonight when I am back home I can probably dig something off my HD for you.
would really appreciate it.
I am lost in the maze, and would love to have live feeds for some sites.
(as painlessly as possible)
Thanks!
Seek... And you shall Find
Ela Seeker. I have an instant RSS solution for Yahoo! feeds if your sites are on Windows servers. It might take a while to convert it to unix/linux servers.
The folowing code has served me extremely well. It parses through XML content, and sends you an array you can pull data out of.Originally Posted by RADiSTAR
I've used this code to pull results from different RSS sources. Just use the "print_r" function in php to see what you got, and just refer to whichever node you need.Code:function GetXMLTreeData($data) { $parser = xml_parser_create('ISO-8859-1'); // xml_parser_set_option($parser, XML_OPTION_SKIP_WHITE, 1); xml_parse_into_struct($parser, $data, $vals, $index); xml_parser_free($parser); $tree = array(); $i = 0; if (isset($vals[$i]['attributes'])) { $tree[$vals[$i]['tag']]['ATTRIBUTES'] = $vals[$i]['attributes']; $tree[$vals[$i]['tag']][] = GetChildren($vals, $i); } else $tree[$vals[$i]['tag']][] = GetChildren($vals, $i); return $tree; } function GetChildren($vals, &$i) { $children = array(); // Contains node data /* Node has CDATA before it's children */ if (isset($vals[$i]['value'])) $children['VALUE'] = $vals[$i]['value']; /* Loop through children */ while (++$i < count($vals)) { switch ($vals[$i]['type']) { /* Node has CDATA after one of it's children (Add to cdata found before if this is the case) */ case 'cdata': if (isset($children['VALUE'])) $children['VALUE'] .= $vals[$i]['value']; else $children['VALUE'] = $vals[$i]['value']; break; /* At end of current branch */ case 'complete': if (isset($vals[$i]['attributes'])) { $children[$vals[$i]['tag']][]['ATTRIBUTES'] = $vals[$i]['attributes']; $index = count($children[$vals[$i]['tag']])-1; if (isset($vals[$i]['value'])) $children[$vals[$i]['tag']][$index]['VALUE'] = $vals[$i]['value']; else $children[$vals[$i]['tag']][$index]['VALUE'] = ''; } else { if (isset($vals[$i]['value'])) $children[$vals[$i]['tag']][]['VALUE'] = $vals[$i]['value']; else $children[$vals[$i]['tag']][]['VALUE'] = ''; } break; /* Node has more children */ case 'open': if (isset($vals[$i]['attributes'])) { $children[$vals[$i]['tag']][]['ATTRIBUTES'] = $vals[$i]['attributes']; $index = count($children[$vals[$i]['tag']])-1; $children[$vals[$i]['tag']][$index] = array_merge($children[$vals[$i]['tag']][$index],GetChildren($vals, $i)); } else { $children[$vals[$i]['tag']][] = GetChildren($vals, $i); } break; /* End of node, return collected data */ case 'close': return $children; } } } function array_detail($obj) { global $__level_deep; if (!isset($__level_deep)) $__level_deep = array(); if (is_object($obj)) print '[obj]'; elseif (is_array($obj)) { foreach(array_keys($obj) as $keys) { array_push($__level_deep, "[".$keys."]"); printa($obj[$keys]); array_pop($__level_deep); } } else print implode(" ",$__level_deep)." = $obj"; }
Here's some code to READ the RSS from a remote server, and save the latest feed locally as a text document (so you're not pull the RSS every time someone views your page):
Finally, this code will READ the XML formatted document (using the functions I first quoted above), and display the results in HTML...Code:$url = "http://rss.topix.net/rss/food/dieting.xml"; $url = parse_url($url); $sock = fsockopen($url["host"],"80",$errno,$error); if (!$sock) { echo ("<b>Could Not Connect To Server.</b> ERROR No.: <I>$errno</I> | ERROR: <i>$error</i>"); exit; }$result = ""; $useragent = $_SERVER['HTTP_USER_AGENT']; $header = ""; $header .= "GET ".$url["path"]." HTTP/1.0\r\n"; $header .= "Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg\r\n"; $header .= "Accept-Language: en-us\r\n"; $header .= "Host: ".$url["host"]."\r\n"; $header .= "User-Agent: $useragent\r\n"; $header .= "\r\n\r\n"; fputs($sock,$header); $getcontent = 0; while(!feof($sock)){ if($getcontent<1 && $result!="\r\n") $result = fgets($sock,128); else { if($getcontent<1)$result=""; $result .= fgets($sock,128); $getcontent++; } } fclose($sock); $filename = "dieting.xml"; // Let's make sure the file exists and is writable first. if (!file_exists($filename)||is_writable($filename)) { // In our example we're opening $filename in append mode. // The file pointer is at the bottom of the file hence // that's where $result will go when we fwrite() it. if (!$handle = fopen($filename, 'w+')) { echo "Cannot open file ($filename)"; exit; } // Write $result to our opened file. if (fwrite($handle, $result) === FALSE) { echo "Cannot write to file ($filename)"; exit; } echo "Success, wrote ($result) to file ($filename)"; fclose($handle); } else { echo "The file $filename is not writable"; } print "<hr>"; print $result;
You'll have to crawl through the details, but once it makes sense, you'll pretty much be unstoppable with grabbing RSS feeds. You just have to know a little PHP.Code:$output = file("newsfeed/dieting.xml"); $output = implode("",$output); //In Case of Problem if(!$output){$output = file("newsfeed/dieting_backup.xml");$output = implode("",$output);} require_once('./newsfeed/functions_extra.php'); $output = GetXMLTreeData($output); $feed = $output["RDF:RDF"][0]["ITEM"]; $newsfeed = ""; foreach($feed as $nf){ //TITLE,LINK,DESCRIPTION $newsfeed .= "<a href=\"".$nf["LINK"][0]["VALUE"]."\" style=\"font-size:12px;color:#000000;\"><b>".$nf["TITLE"][0]["VALUE"]."</b></a><br>"; $newsfeed .= "<small style=\"font-size:11px;color:#000000;\">".$nf["DESCRIPTION"][0]["VALUE"]."</small><br><br>"; } $newsfeed = "<table cellpadding=10 cellspacing=0 border=0><tr><td>".addslashes($newsfeed)."</td></tr></table>";
For a more "packaged" solution, here's a moldy oldey that you might be able to modify to your own needs.
http://www.dansteinman.com/php/pheadlines/
DEMO:
http://www.dansteinman.com/php/phead...headlines.php3
This bad boy works like a charm, caches results, but... I'm not sure how up-to-date it is (and doesn't show examples from Yahoo's feeds).
Cheers,
~ Nexus
FreeWho.com - Free Internet Tools!
My friend Alex, here's some RSS resources that I use:
http://www.rssforums.com
http://forum.free-templates.com/forumdisplay.php?f=34
Thanks everyone!!!
excellent resources, codes, and links. I apprciate it.
Seek... And you shall Find
Here's a site I use that will generate a code for just about any news subject, you can customize with style sheets.
ED
http://anyrss.maquis.org/
Bookmarks