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.
-
$this->load->library(‘domparser’);
-
$html = $this->domparser->file_get_html(‘http://www.google.com/’);
-
$rank = $html->find(‘b.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
Tagged: codeigniter, DOM Parser, PHP simple DOM parser
Quite spiffy sir. Thanks.
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 : )
Trying to run this on godaddy and it appears to be freezing up on the library load.
Any idea why?
Thanks a lot! Fortunately I found your website before I was going to do this by myself
[...] http://www.thephpx.com/2009/10/25/php-simple-html-dom-parser-codeigniter-integration/ [...]
Hope it still working
it working. clicking again at google adv – be happy and rich
Works great!
Thanks!
Thanks!
codeigniter 2.0.* version?
hi shuffledex,
If its version compatibility you looking for, I guess it will still work on the latest one out, but it was originally implemented for codeigniter 2.0 or you can say 2.0.0
thanks,
faisal ahmed
I’m using CI 2.0.3 and it did not work. I always get “No such file or directory” but when I use simple_html_dom.php the url I’m trying to get is fetched. BTW where did you put the domparser.php? I put it in system/libraries
Hi James,
Sorry about the delayed response and tes you are suppose to put the library at the application/libraries/ folder. The given library here was tested on 1.7.3 and was not tested on 2.0.3
So, not away of any issues regarding the latest release
thanks,
faisal ahmed