How to join RSS feeds into one? (from php) - php

How to join RSS feeds into one? (from php) what libs can help us with it?

You'll want to use SimpleXML
Either that, or you can use something like Yahoo! Pipes to merge them for you can create a merged RSS feed for you.
http://pipes.yahoo.com/pipes/
if you use pipes, be sure to filter by date, so you can get a feed with all the posts in chronological order. I've used it for a few things and it works great!

Related

Simple RSS reader in php with continuous scrolling

I already made a simple RSS reader, but it only gets me like 25 articles. How do I make it to work like feedly.com or digg.com, so that it retrieves me many more feeds, and not only 25?
The php code I have:
$rss = simplexml_load_file('http://www.elespectador.com/rss.xml');
I already know how to retrieve the title, description, etc. of each item.
Pagination in feeds is arbitrary and you'll have trouble finding a consistent pattern. You should store any data so that now you have 25 elements, but when new ones are added, you keep adding more and more.
Another solution is to use the data from a service like Superfeedr (I created it!) which stores past content for milions of feeds.

Finding "similar" articles in an RSS feed with PHP

There is something I am trying to accomplish although I'm not really sure where to start.
I currently have a MySql database with a list of articles. The DB contains the article title, content, and some other info like dates, etc.
There is an RSS feed that we monitor for new articles, it's a Google Alert feed that just contains the latest news on certain subjects. I want to be able to automatically monitor this feed and record any feed items that are similar to stories currently in our DB.
I know how to set a script to run automatically, and I know how to parse the RSS feed with SimplePie.
What I need to figure out is how to take the description of the rss feed items, run a check on our DB to see if the feed item is similar to something we have in our DB, and return a numerical score of some sort, sort of like a "similarity rating" or something.
After that I can have the info I need recorded to the DB if the "similarity rating" is above a set limit, which I know how to do.
So my only issue is how to compare each feed item to our current articles, and return a score based on how similar it is.
The Levenshtein function (available for both PHP and MySQL) is a good way to handle this. It basically calculates a value based on the number of permutations (replacements, moves, etc) required to convert one string to another. That score would be your "similarity rating".
EDIT: the Levenshtein function is not available natively in MySQL but there are SQL implementations of it that you can use such as: http://kristiannissen.wordpress.com/2010/07/08/mysql-levenshtein/

How to mix more than 10 RSS feeds?

I just want to mix around 10 rss feeds into one and then i want to filter the results as per my requirements.
I know we can use yahoo pipes like solution for this,but due to some reasons i do not want to use yahoo's facility so is their any open source solution which i can host on my server and mix feeds using it.
I am using PHP for development along with Javascript(jquery).
Can i do this using simplepie.
Yes, use SimplePie. set_feed_url() accepts an array, and will combine all of them for you automatically.
$feed = new SimplePie();
$feed->set_feed_url(array('your','urls','here'));

Get feed titles from any RSS feed with php

I'm attempting to build an RSS reader at the moment I'm using php's simplexml using
For example
$xml->item->title
But however this is dependent on the structure of the rss feed itself if the structure is different it won't work so I was wondering if theres a more broader and less specific way to grab all the titles from a RSS feed.
Thanks a lot
There is a RSS Specification document out there. You can find it at http://cyber.law.harvard.edu/rss/rss.html
Therefore, a RSS file always looks the same, but be carefull. There is always something like Atom.
You could use xPATH for searching within the RSS: http://nl.php.net/manual/en/simplexmlelement.xpath.php
maybe it´s an option for you using a contribution like this instead of invent the wheel again: http://www.phpclasses.org/package/3724-PHP-Parse-and-display-items-of-an-RSS-feed.html
You can use some Regex to filter the RSS files and split them into titles, etc. Whatever you want. As you will define which tags to grab data from.
Using something like: $regex = '/<(w+)[^>]*>(.*?)</\1>/s';
preg_match_all($reg_exp, $text, $match);
There are lot of feed formats. Writing code to comply all, is a bit difficult task. so..
I recommend using simple pie. http://simplepie.org/
or you can use google feed api also. here is a example using simple pie.
http://simplepie.org/wiki/setup/sample_page

Seeking a PHP script to filter an RSS feed

I have about 50 feeds (and growing) that I would like to filter before adding them to Google Reader. Each of the feeds will be filtered for the same keywords. If a keyword match is found, that item will be removed from the feed. Basically I'm just trying to eliminate some noise.
I know I can do this with Yahoo Pipes, but I'm looking for a self-hosted solution.
I'd like to pass a feed to a script on my server. That script will filter out unwanted feed items based on a list of defined keywords. The filtered feed will be the result. I plan to then add the feed to Google Reader.
(BTW, why doesn't Google Reader have filters like Gmail?)
Try using a RSS library like Simplepie. From there, writing the filter logic should be easy-peasy.
Try ReFilter. Looks nice.

Categories