tags:

views:

47

answers:

2

Hi,

How to get all unique words from a webpage in an array? (without all attributes and javascript etc.)?

Could anybody help me with this?

A: 

try this get_text this one will help you: http://mel.melaxis.com/devblog/2005/08/06/localizing-php-web-sites-using-gettext/

key
Could you give me an example? I don't get it right now.
Kevin
+1  A: 

Have a look at http://simplehtmldom.sourceforge.net/

Then do something like:

<?php

include_once('simplehtmldom/simple_html_dom.php');

$string = file_get_html('http://www.google.com')-&gt;plaintext;
$words = preg_split('/[\s,.]+/', $string, null, PREG_SPLIT_NO_EMPTY);

var_dump(array_unique($words));

?>
Xhantar