I'm writing a link database, and for the search engine I'm using
I'm building a keyword list. To get keyword I use fopen to actually visit the link, suck out all the html tags and non-alphanumeric stuff, and then I have a list of common words that I would like to delete from the keyword list as well.
Unfortunately, it seems that my call to str_replace has no effecte. Here's all of(I'm hoping) the relevant code...
// Remove meaningless keywords here
$file = fopen("include/badwords.txt", "r");
$commonwords = array();
while(!feof($file))
{
$word = strtoupper(fgets($file));
array_push($commonwords, $word);
}
$text = strtoupper($text);
$text = str_replace($commonwords, "", $text);
Badwords.txt is just a list of common words, all in caps, one each line. $text is the keyword list. By the time this code executes it's just a string of words separated by spaces.
Help would most certainly be appreciated.