How to produce a merged RSS feed (from DokuWiki and Serendipity) - php

I've got an application developed on top of DokuWiki. I'd like to provide a 'News' page providing the latest updates from the internal RSS feed, some other feeds maintained in Serendipity and potentially other locations.
Although its trivial to attach feed parsers to each one individually, I'd like to aggregate this into a single list (possibly a single RSS feed).
Both the DokuWiki and Serendipity servers are not connected to the internet - so I can't use an external service for this - looking for code.
Anybody got any ideas?
TIA
C.

Basically speaking, you'll have to :
Fetch the entries from both feeds
Merge them into an array of entries
Create a new feed, with your own headers, and containing those entries.
A couple of tools that could probably help :
Zend_Feed_Reader, for the first part
and Zend_Feed_Writer, for the second part
And you might want to take a look at padraic / ZFPlanet : it's an aggregator -- there are probably some ideas in there that could help you get started ;-)

DokuWiki already comes with the SimplePie feed aggregation library so you can use that without the need for any additional libraries. Some tips on how to merge two feeds can be found in their documentation:
http://simplepie.org/wiki/tutorial/sort_multiple_feeds_by_time_and_date
http://simplepie.org/wiki/faq/typical_multifeed_gotchas

Related

Generate keywords for contents through Solr

I'm integrating Solr for my new PHP application.
As I'm newbie in solr section, I want to know that is it possible to generate some useful tags for every content pages through solr? something like auto-tagging mechanism.
Thanks in Advance...
P.S My contents available in both Persian and English languages.
something like auto-tagging mechanism.
Yes, you can build something like that.
There are 2 different ways to realize that:
Use the Clustering Component from Solr to build groups of docs and label those docs by solr. The labels are something like the taggs your are looking for.
Realize a tagging by using the MLT feature.
I started an auto-tagging project with the 1.) method with medium success. Finding labels for a cluster of documents is an hard process.
But fortunately, I had some already taggegd documents. If you also have some documents with valid tags, than you can use the 2.) method to use those document as an base to start learning:
Take a document without tags and perform a MLT search against docs with tags. Take the tags from the docs you fond and count them. Depending on the count, apply one or more tags to the untaggegd document. In my case, that works very well. Method 2.) is an cheep implementation of machine based learning, but you will get 95% success with only 5% Work-input.
As it's a PHP application, if it's OK for you to generate tags in php and then inserting/updating to Solr, Here are few options -
If using a web service is OK, check Yahoo's Term Extractor
If you can/want to host a term extraction service yourself to (may be in local server), check FiveFilters
Here is a php function for extracting valuable words from text block. Surely not as efficient as Yahoo Term Extractor, but it may work for you.

Automatically generate RSS feeds

I have information stored in a database that I want to use to create RSS feeds.
What is the best way to do this?
Also, are there any PHP library/functions that I can pass the data to and they will take care of ensuring that any characters that need to be encoded/stripped are dealt with?
PHP Universal Feed Generator is the one you are looking for.
It supports RSS 1.0, RSS 2.0 and ATOM
If you know how to dynamically create an XML, it's pretty much the same, you just need to look on way to format an RSS, and off you go.
After you created the rss - you can validate it here:
http://validator.w3.org/feed/
Here is a short wiki article on how it's supposed to be formatted: http://en.wikipedia.org/wiki/Rss
I prefer the Zend_Feed component, which is part of Zend Framework. Just have a look at Zend_Feed_Writer in the Reference Guide, to see how to export data as a feed.
http://careers.stackoverflow.com/jobs/feed
Just look at this RSS-example (right click for Source Code). It's a functional and used RSS and all you really need is to create a HTML-similiar page with dynamic data yourself.
EDIT:
I personally don't see the point of using a plugin for this. It's so similiar to HTML that you may aswell just create it with given tags in above example.

extract data from site and put into a file

got this project where the client has lost their database,hence i got to look up into their current(live)site and retrieve information... problem is that there is too much data that i have to copy and insert into the database which is taking a lot of time ...could you suggest some code which could help me ?
You can use DOMDocument library for php and write automated scripts to retreive data after identifing where are your informations in the page usin tags.
http://www.php.net/manual/en/book.dom.php
The library is very robust and uses xpaths.
http://www.w3schools.com/xpath/xpath_examples.asp
If the pages are all very similar in structure, you could try to use regular expressions or a html parser (tidy) to filter out the relevant data.
I did a similar thing for a customer who had 200+ handwritten product pages with images, titles and text. The source seemed to have been copy-pasted from the last page, and had evolved into a few different flavors. it worked great after some tweaking.

Multiple REST Feeds to MYSQL Database - Using PHP

I've got a number of REST feeds I'd like to store in a MYSQL database, can anyone suggest a solution for this? Something PHP related appreciated....
It's not PHP related, but PERL has both a REST interface and a DBI interface (for interfacing with MYSQL).
http://metacpan.org/pod/WWW::REST
There are many other REST interfaces for Google, Twitter, etc. Just search CPAN modules at search.cpan.org
To my knowledge there is no such thing as a REST feed. There are RSS feeds and Atom feeds, so I will assume you are talking about one of those.
Both are based on XML so I suggest you find an XML parser for PHP and do an HTTP request to get the feed contents, parse the XML into a DOM and then copy the DOM data into MYSQL!
I'm not sure how to be more precise.
Are you looking for someone to write the code?
Ok, I'm assuming you are talking about "RSS" feeds. Here's a great opensource library that makes it easy -- http://simplepie.org/ . Point it at an RSS or Atom feed, it will give you back PHP arrays and objects. From there you can interpret them and save them any way you want.
Depending on what you actually want to do with the database, you could use RSS as an XML clob format. Not fast, but easy. Again, it totally depends on what you want to do with the database.

Is there a site which simply outputs the latest stable version numbers of php and mysql?

I want to write a little app for myself which notifies me if there is a new version of php or mysql but I would need a feed or an xml file to read it from.
PHP.net provides one
http://www.php.net/releases/index.php?serialize=1
An alternative that may allow you to add additional software later is looking into the feeds provided by freshmeat:
http://freshmeat.net/projects/mysql/
You could probably subscribe to www.freshmeat.net's rss feed and only react when an even numbered version shows up.

Categories