Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

html parser codeigniter library?

Tags:

codeigniter

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

like image 691
Gerard Banasig Avatar asked Nov 20 '09 02:11

Gerard Banasig


2 Answers

Similar questions have been asked here and here

Hopefully that helps.

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

like image 131
Blaine Lafreniere Avatar answered Oct 28 '22 15:10

Blaine Lafreniere


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.

like image 21
Gerard Banasig Avatar answered Oct 28 '22 14:10

Gerard Banasig