Simon
Simon

Reputation: 5698

PHP Word Crawler

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

Could anybody help me with this?

Upvotes: 0

Views: 705

Answers (2)

Xhantar
Xhantar

Reputation: 7448

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')->plaintext;
$words = preg_split('/[\s,.]+/', $string, null, PREG_SPLIT_NO_EMPTY);

var_dump(array_unique($words));

?>

Upvotes: 1

key
key

Reputation: 23

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

Upvotes: 0

Related Questions