A: 

You could use an RSS reader class such as http://www.phpclasses.org/package/2552-PHP-Retrieve-and-parse-RSS-feeds-extending-feed-reader.html

It is really simple to use:

include("./files_includes/RSSReader.inc.php"); 
$rss = new RSSReader("http://www.php.net/news.rss");

see the example at http://www.phpclasses.org/browse/file/10759.html

I do not really understand why you would like to explode all the word in the description, but with that class you could do it something like:

explode(' ',$rss->getItemDescription("rsstext",$i));

Be aware that the class is dependent on the FeedReader-class: http://www.phpclasses.org/package/1811-PHP-Parse-and-extract-information-from-RSS-2-0-feeds.html - so you need to download that too.

alexteg
A: 

You need to end up with a VALUES clause of the form ('word1'),('word2'), ... Something like this should work:

$string="This is a cat";
$arr=explode(' ',$string);
array_walk($arr, function(&$v,$i){ $v="('$v')"; }); //php5.3 syntax only, use create_function() otherwise

$values=implode(','$arr);
$query="INSERT INTO mytable(term) VALUES $values";
dnagirl
+1  A: 

As long as the RSS feed is valid XML, you can use PHP's XML parser to do this..

Here's a simple example running against Stack Overflow's Recent Questions feed..

<?php
$parser = xml_parser_create('UTF-8');
$values = array();
xml_parse_into_struct($parser, file_get_contents('feed.xml'), $values);

$db = new MySQLi('localhost', 'root');
$db->select_db('test');
$db->query('create table if not exists words (id int unsigned primary key auto_increment not null, word varchar(255) not null)');
$stmt = $db->prepare('insert into words (word) values(?)');

foreach ($values as $entry) {
    if ($entry['tag'] === 'SUMMARY') {
        $words = preg_split('/\s+/', strtolower(preg_replace('/[^A-Za-z\s]+/', '', strip_tags($entry['value']))));
        foreach ($words as $word) {
            $stmt->bind_param('s', $word);
            $stmt->execute();
        }
    }
}

Once you have that, you can run fun queries like:

select word, count(*) from words
group by word
order by count(*) desc

Which returns result sets like:

+------+----------+
| word | count(*) |
+------+----------+
| the  |      127 |
| i    |       90 |
| to   |       74 |
|      |       60 |
| a    |       59 |
| is   |       45 |
| in   |       44 |
| and  |       41 |
| it   |       38 |
| have |       31 |

etc ...
Matt
Thanks Matt, that's a lot like what I am trying to do. I revised the code a little bit because I was having trouble with MySQLi, but it is still not working . .
K.I