Ninjakreborn Posted February 8, 2007 Share Posted February 8, 2007 I need a new's feed * Universal reports * By zipcode (optional) * Can be viewed in spanish/english Any ideas on something php/mysql, something free/open source, or something in xml. Quote Link to comment https://forums.phpfreaks.com/topic/37655-solved-news-feed/ Share on other sites More sharing options...
zq29 Posted February 8, 2007 Share Posted February 8, 2007 Do you know what a news feed is? Quote Link to comment https://forums.phpfreaks.com/topic/37655-solved-news-feed/#findComment-180153 Share on other sites More sharing options...
Ninjakreborn Posted February 8, 2007 Author Share Posted February 8, 2007 Sorry * News Aggregator. However no, I don't know too much about what they are. I know a new's feed is an xml feed with new's, and an aggragator handles feed's. I just need "something" that handles what I asked, or atleast a good new's feed that I can rely on. I don't know exactly what is needed either, he just said he wanted hispanic news setup on his site, not sure what I am looking for, just looking. Any advice? Quote Link to comment https://forums.phpfreaks.com/topic/37655-solved-news-feed/#findComment-180160 Share on other sites More sharing options...
Daniel0 Posted February 8, 2007 Share Posted February 8, 2007 Why not just use RSS feeds from various news websites? Quote Link to comment https://forums.phpfreaks.com/topic/37655-solved-news-feed/#findComment-180169 Share on other sites More sharing options...
Ninjakreborn Posted February 8, 2007 Author Share Posted February 8, 2007 Hmm, that is the thing. Needing to get together something quickly A simple system that is already built to handle it, if there is nothing I have no choice however. Quote Link to comment https://forums.phpfreaks.com/topic/37655-solved-news-feed/#findComment-180174 Share on other sites More sharing options...
ober Posted February 9, 2007 Share Posted February 9, 2007 ??? First of all it's "news"... not "new's". Secondly, it's going to be hard to find a feed in spanish since most international news is in english. Third, handling a feed is really quite simple. <div style="overflow:auto;height:100px;border:1px solid gray;background-color:white;padding:5px;font-size:10pt;" class="smalltext"> <?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><b><a href='%s'>%s</a></b></dt>", trim($link),htmlspecialchars(trim($title))); printf("<dd>%s</dd>",htmlspecialchars(trim($description))); $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://www.entrepreneur.com/feeds/marketing.rss","r") or die("Error reading RSS data."); while ($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))); fclose($fp); xml_parser_free($xml_parser); ?> </div> Simply replace the link with the address to whatever feed you want to pull. Quote Link to comment https://forums.phpfreaks.com/topic/37655-solved-news-feed/#findComment-180607 Share on other sites More sharing options...
ober Posted February 9, 2007 Share Posted February 9, 2007 Additionally "universal reports" doesn't make much sense unless that is somehow supposed to mean "international". And you're never going to find a feed that is zipcode specific. You'd have to get the feed from local news stations. Quote Link to comment https://forums.phpfreaks.com/topic/37655-solved-news-feed/#findComment-180608 Share on other sites More sharing options...
Ninjakreborn Posted February 9, 2007 Author Share Posted February 9, 2007 Ok, that is very helpful. Thanks to both of you. I will start looking around for feed's then work with that code to get them to display. Thanks again SOLVED Quote Link to comment https://forums.phpfreaks.com/topic/37655-solved-news-feed/#findComment-180641 Share on other sites More sharing options...
Ninjakreborn Posted February 13, 2007 Author Share Posted February 13, 2007 The code you gave me is amazing. THis is something I Fought with on another project that took me about 2 weeks and still didn't finish. I was wondering,w hat about this code makes it work for any situation. Can you reput the code (anyone) and comment it as best you can to help me fully understand the code, so I can understand it and study it some? Thanks again for the help. Quote Link to comment https://forums.phpfreaks.com/topic/37655-solved-news-feed/#findComment-183888 Share on other sites More sharing options...
ober Posted February 14, 2007 Share Posted February 14, 2007 What makes it work for any situation??? Possibly the fact that RSS feeds all use the same format and tags? The code is really quite simple. If you spend more than five minutes with it, I really think you'll be able to figure it out. Quote Link to comment https://forums.phpfreaks.com/topic/37655-solved-news-feed/#findComment-184580 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.