指定した単語が Web ページに表示される回数を返すスクリプトが必要です。PHPでこれを行う方法を知っている人はいますか?コードは次のようになります。
<?php
$url="watever.com";
the script here
echo(result);
?>
Web ページ上のすべての単語が何回表示されるかを示すこの小さなビットはありますが、1 つの単語だけを変更する方法がよくわかりません。
$str = file_get_contents('http://www.example.com/');
print_r(array_count_values(str_word_count(strip_tags(strtolower($str)), 1)));