tags:

views:

484

answers:

2

Does someone here know a html parser library that will work with codeigniter?

+1  A: 

Similar questions have been asked here and here

Hopefully that helps.

More possibilities include DOMDocument::loadHTML and PHP Simple HTML DOM Parser

Blaine LaFreniere
they don't work with codeigniter AFAIK
Gerard Banasig
Thanks a lot @jacolyte but those are native php libraries, I need one that will run with codeigniter's library system
Gerard Banasig
Most libraries can be used with CodeIgniter (I frequently use `markdown` and others). Just `require` them from a centra location (like `config/configure.php`), or place them in `libraries/` with a CI-style class wrapper.
Bruce Alderson
Why do you need one that 'will run with codeigniters library system' ? What difference does it make?
Jessedc
a php library needs to be extended modified to fit the library structure of codeigniter http://codeigniter.com/user_guide/general/creating_libraries.html
Gerard Banasig
+1  A: 

I was able to figure out how to run Simple_html_dom php library on codeigniter

I copied the file Simple_html_dom.php to

/system/libraries

Then in my controller I call it using

require_once('Simple_html_dom.php');    

To use it I initialized it using this line

$html = new Simple_html_dom();

Load a page or link using the line

$html->load_file('http://www.google.com');

and parse or find elements using this line

$html->find('table tr td')->plaintext;

works fine and fits right to what I needed to do.

Gerard Banasig
Also, you can probably put it in /application/libraries instead of /system/libraries (I think that's the suggested practice).
Matthew