Jump to content

Page Level RSS filter by Keyword


Recommended Posts

I am desperatly seeking some help.


I want to build a page that pulls in feeds from 3 different sites, but i would like them to be filtered by some keywords.


I'm not entirely sure about the best way to do this. If there's any one who knows about Magpie, and how to incorporate this feature, that would be great.


Curretnly in my magpie rss fetch script I have:


$keywords  = array ("keyword1","keyword2","keyword3")


function has_keyword($haystack, $wordlist)


  $found = false;

  foreach ($wordlist as $w)


    if (stripos($w, $haystack) !== 0)


      $found = true;



  return $found;



$rss = simplexml_load_file("http://www.mywebsite.com/my/rss/feed/");

foreach ($rss->channel->item as $i)


  if (

      has_keywords($i->title, $keywords)

  || has_keywords($i->description, $keywords)

  || has_keywords($i->category)



    $news[] = array


        "title" => $i->title,

        "description" => $i->description,

        "link" => $i->link




Link to comment
Share on other sites

This thread is more than a year old.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.