Gerard Banasig
Gerard Banasig

Reputation: 1713

html parser codeigniter library?

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

Upvotes: 12

Views: 9009

Answers (2)

Gerard Banasig
Gerard Banasig

Reputation: 1713

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.

Upvotes: 16

Blaine Lafreniere
Blaine Lafreniere

Reputation: 3600

Similar questions have been asked here and here

Hopefully that helps.

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

Upvotes: 6

Related Questions