thephpx random header image

PHP Simple HTML DOM Parser, Codeigniter Integration

October 25th, 2009 by admin · 1 Comment

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

1 response so far ↓

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

    Quite spiffy sir. Thanks. :-)

Leave a Comment