thephpx random header image

PHP Simple HTML DOM Parser, Codeigniter Integration

October 25th, 2009 by admin · 2 Comments

Hi all,

I came across “Simple HTML DOM Parser” recently that allows jQuery like DOM selection. This function is quite handy to do some kungfoo DOM manipulation on the fly!

I needed to use it on codeIgniter so modified the files and integrated it into a single codeIgniter library. The original files can be accessed from here its sourceforge project page. For the codeigniter version of the library click here.

  1. $this->load->library(‘domparser’);
  2. $html = $this->domparser->file_get_html(‘http://www.google.com/’);
  3. $rank = $html->find(‘b.gb1′);
  4.  
  5. print_r($rank); // will show all content of tag with class gb1

For further utility functions of the DOM parser visit this link.

Feel free to comment or contact me directly for any query.

take care,

thephpx

Tags: codeigniter

2 responses so far ↓

  • 1 Kyle Farris // Oct 26, 2009 at 2:48 am

    Quite spiffy sir. Thanks. :-)

  • 2 Daniel // Mar 5, 2010 at 8:46 pm

    Hey,

    Thanks for the files… am about to test it now. Will post back if any problems

    Do you have any idea what version of CI you modified the files for?

    fingers crossed : )

Leave a Comment