I need a PHP script which takes a URL of a web page and then echoes how many times a word is mentioned.
This is a generic HTML page:
The one line below will do a case insensitive word count after stripping all HTML tags from your string.
Live Example
print_r(array_count_values(str_word_count(strip_tags(strtolower($str)), 1)));
To grab the source code of a page you can use cURL or file_get_contents()
$str = file_get_contents('http://www.example.com/');
From inside out:
1
returns an array containing all the words found inside the string.