webbysanchez Posted June 25, 2011 Share Posted June 25, 2011 Hello, We have a web-based lead generation application and we'd like to push all leads to an RSS feed. However, each of our users should have their own individualized feed that contains filtered results from the main RSS feed. For example, if the feed contains certain strings, company names, categories, etc. The concept is not every user will want to see all leads, they just want to see their own leads or their "favorites". The solution must be scalable to accomodate 1K, 5K, 10K + users with their own personalized feeds. Questions: [*]How do we set this up? [*]What open source tools/scripts are available for feed creation? [*]What open source tools/scripts are available for feed parsing/filtering to fit my needs? Our application is written in PHP, MySQL and Javascript. Quote Link to comment https://forums.phpfreaks.com/topic/240347-application-using-rss-feeds/ Share on other sites More sharing options...
QuickOldCar Posted June 26, 2011 Share Posted June 26, 2011 What I did was make a search type feed, so the feeds are dynamic for specific items. This is done by a mysql query and where statements, I use match against in booleon mode, but like,match,where,and,or statements would also work. I'll give my feed examples then some code to show how I did it. main feed http://dynaindex.com/feed/ a simple feed creation page, but placing values into a url also works the same http://dynaindex.com/dyna-feed.php custom feeds: php+tutorials http://dynaindex.com/feed/?keyword=%2Bphp+%2Btutorial php+coding http://dynaindex.com/feed/?keyword=+php+coding alien+ufo http://dynaindex.com/feed/?keyword=alien+ufo And this is how I generate the feeds, made a folder called feed, this script is index.php you will of course have to change values to your own <?php //i use this for caching of the feeds //include 'feed-cache.php'; //$fch = new cache(); //header type header("Content-Type: application/rss+xml; charset=UTF-8"); //database connect information DEFINE ('DB_USER', 'user'); DEFINE ('DB_PASSWORD', 'password'); DEFINE ('DB_HOST', 'localhost'); DEFINE ('DB_NAME', 'db_name'); $connection = @mysql_connect(DB_HOST, DB_USER, DB_PASSWORD) or die('Could not connect to database'); mysql_select_db(DB_NAME) or die ('Could not select database'); //get keywords $keyword=mysql_real_escape_string(strtolower(trim($_GET['keyword']))); //check if a keyword exists, if not show main feed if (!isset($_GET['keyword']) || $keyword == "") { $query = "SELECT * FROM table_name ORDER BY ID DESC LIMIT 0,20"; } else { $query = "SELECT * FROM table_name WHERE post_status='publish' AND MATCH (post_title,post_content) AGAINST ('$keyword' IN BOOLEAN MODE) ORDER BY ID DESC LIMIT 0,20"; } $result = mysql_query($query) or die ("Could not execute query"); //start of feed $rssfeed = '<?xml version="1.0" encoding="UTF-8"?>'; $rssfeed .= '<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">'; $rssfeed .= '<channel>'; $rssfeed .= '<atom:link href="http://dynaindex.com/feed" rel="self" type="application/rss+xml" />'; $rssfeed .= '<title>DynaIndex.com ' .$keyword. ' feed</title>'; $rssfeed .= '<link>http://dynaindex.com</link>'; $rssfeed .= '<description>Dynaindex ' .$keyword. ' posts</description>'; $rssfeed .= '<language>en-us</language>'; $current_year = date('Y'); $rssfeed .= "<copyright>Copyright (C) 2009-" .$current_year. " DynaInternet.com</copyright>"; //results loop while($row = mysql_fetch_array($result)) { $post_url = "http://".$row['post_title']; $hyperlink = "<a href='http://dynaindex.com/index.php?post=$post_url'>$post_url</a> "; $title = $row['title_2']; $title = htmlentities($title); $post_date = $row['post_date']; $timedifference = 14400; $get_date = strtotime($post_date); $show_date = date("D, d M Y H:i:s O",$get_date+$timedifference); $permalink = "http://dynaindex.com/index.php?post=".$row['post_name']; $thumb = "http://get.blogdns.com/url-thumb.php?size=400&text=DynaIndex.com&textsize=12&textcolor=aqua&url=$post_url"; $rssfeed .= '<item>'; $rssfeed .= '<title>' . $post_url . '</title>'; $rssfeed .= '<guid>' . $permalink . '</guid>'; $rssfeed .= "<description><![CDATA[<p align=center><a href='http://get.blogdns.com/out/bar.php?url=$post_url' TARGET='_blank'><img src='$thumb' alt='$post_url'/a><br /> $title <hr></p>]]></description>"; $rssfeed .= '<link>' . $permalink .'</link>'; $rssfeed .= '<pubDate>' . $show_date . '</pubDate>'; $rssfeed .= '</item>'; } $rssfeed .= '</channel>'; $rssfeed .= '</rss>'; echo $rssfeed; //close caching //$fch->close(); ?> Quote Link to comment https://forums.phpfreaks.com/topic/240347-application-using-rss-feeds/#findComment-1234860 Share on other sites More sharing options...
webbysanchez Posted August 13, 2011 Author Share Posted August 13, 2011 Thanks for the reply. I was trying to check out your links but most of them are dead. Is your server down? Quote Link to comment https://forums.phpfreaks.com/topic/240347-application-using-rss-feeds/#findComment-1256890 Share on other sites More sharing options...
QuickOldCar Posted August 14, 2011 Share Posted August 14, 2011 Yes it was down, it seems I get a lot of bad storms lately, try it now. Quote Link to comment https://forums.phpfreaks.com/topic/240347-application-using-rss-feeds/#findComment-1256956 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.