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
2009-11-20 02:33:08
they don't work with codeigniter AFAIK
Gerard Banasig
2009-11-20 03:12:43
Thanks a lot @jacolyte but those are native php libraries, I need one that will run with codeigniter's library system
Gerard Banasig
2009-11-20 04:00:17
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
2009-11-20 17:59:29
Why do you need one that 'will run with codeigniters library system' ? What difference does it make?
Jessedc
2009-12-04 03:02:27
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
2010-01-22 06:36:28
+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
2010-01-22 07:17:35
Also, you can probably put it in /application/libraries instead of /system/libraries (I think that's the suggested practice).
Matthew
2010-09-04 13:28:10