views:

157

answers:

2

Hi,

I am trying to write a screen scraper in php. I am having a nightmare trying to figure out how to do regular expressions. However I have found a library that is suppose to remove the need to use regular expressions when screen scraping. It is called simplehtmldom.

However I can't even figure out how to install it. I have downloaded it from sourceforge but the manual does not explain how to install it.

I am using ubuntu 9.04.

Any help would be appreciated.

Thanks, Glen.

+1  A: 

For PHP, you would normally package the PHP file somewhere with your code and then use require() to include this code into your PHP.

So put simple_html_dom.php somewhere in your application directory and then do:

require('simple_html_dom.php');

Installing the file in the OS doesn't really get you anywhere since it needs to be accessible on your server. However, you could place the PHP file somewhere in your web root above your application and then reference the require to this file.

Michael Mior
A: 

I second michael's answer, looking at a google search came across this page where:

"First download the library from sourceforge. Unzip the library in you PHP includes directory or a directory where you will be testing the code."

http://www.codediesel.com/php/web-scraping-in-php-tutorial/

might also give you some examples to start using it, article seems interesting!

Javed Ahamed