Filter a RSS flux by keywords in PHP -


I have a small site in PHP (which is dynamic, still stable). I think many sites publish RSS flux or whatever names

I wonder if there is a possibility to load such a RSS flow, filter it by site keyword theme and use it in PHP Display something like a thematic news column.

Is this work complicated? What should I do? I'm totally new in the field, so sorry if such questions have already been answered.

Update: There were some errors in this reply code.

  & lt; RSS version = "2.0"> & lt; RSS version = "2.0"> & lt; RSS version = "2.0"> & lt; Channel & gt; Title> (title) & lt; / Title> & lt; Details> (Details) & lt; / Description> & lt; Link >> & lt; Item & lt; Title> New RSS creation tool & lt; / Title> & lt; Details> Produces feedsable RSS feeds, so that webmasters do not have to struggle with feed generation & lt; / Description> & lt; Link> & lt; / Link> & lt; PubDate> August, 22 2004 00:12:30 EST & lt; / PubDate> & lt; Category> software & lt; / Category> & lt; / Item> & lt; / Channel> & lt; / Rss>   

You can title, describe and / or scan the category tag for the keywords you typed.

Assume that you have an array in your PHP script, that is,

  $ keywords = array ("php", "mysql", "open source");  

Then, you can parse RSS feed by using SimpleXML:

  is the function_keywords ($ haystack, $ wordlist) {$ found = wrong; Foreign exchange ($ word list $ w) {if (strippause ($ haystack, $ w)! == incorrect) {$ found = true; break; }} Returns $$; } $ Rss = simplexml_load_file ("http://www.mywebsite.com/my/rss/feed/"); ($ I-> title, $ keyword) || Is_keyword ($ i-> description, keyword $) || ($ I-> category)) {$ News [] = Array ("title" => $ i-> title, "description" => $ i-> description, "link" => $ i-> link) ; }}  

This will give you an array $ news , which is populated with the data you selected through the keyword.

Through $ news you can present it with just any HTML code.

On the one hand, you can do the same thing with Javascript and XMLHttpRequest, there is no need for PHP intervention, please load the feed as XML and go with the same process. To render the data, you can use the document.createElement () to add the child nodes containing the information you requested.


Comments

Popular posts from this blog

oracle - The fastest way to check if some records in a database table? -

php - multilevel menu with multilevel array -

jQuery UI: Datepicker month format -