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

  • Share/Bookmark