slider2015 Posted March 21, 2011 Share Posted March 21, 2011 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 ); } } Quote Link to comment 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.