Did you get this out of the book PHP and MySQL Web Development? Because there is a section in chapter 24 just like it. From what I can tell and I have not used this yet but will be is ispell is a server side program you need to acces it as one not from a URL this is what is in the book, hope this will help.
function get_random_word($min_length, $max_length)
// grab a random word from dictionary between the two lengths
// and return it
{
// generate a random word
$word = '';
//remember to change this path to suit your system
$dictionary = '/usr/dict/words'; // the ispell dictionary
$fp = fopen($dictionary, 'r');
if(!$fp)
return false;
$size = filesize($dictionary);
// go to a random location in dictionary
srand ((double) microtime() * 1000000);
$rand_location = rand(0, $size);
fseek($fp, $rand_location);
// get the next whole word of the right length in the file
while (strlen($word)< $min_length || strlen($word)>$max_length || strstr($word, "'"))
{
if (feof($fp))
fseek($fp, 0); // if at end, go to start
$word = fgets($fp, 80); // skip first word as it could be partial
$word = fgets($fp, 80); // the potential password
};
$word=trim($word); // trim the trailing \n from fgets
return $word;
}
The portion that is $dictionary = '/usr/dict/words'; // the ispell dictionary is telling the server where it is on the pc not on the web. It is a linux server side dictionary and must be used as one. This is why there is fopen and it runs this as a comand on your server "/usr/dict/words r", well something like that! Good luck