This article describes the Codeigniter DOM class usage examples. Share it with everyone for your reference. The specific analysis is as follows:
Using the simple_html_dom dom class, a class library modified for CI, it can analyze HTML elements like JS. It is suitable for analyzing web page data when crawling web pages.
Class library download address: http://sourceforge.net/projects/simplehtmldom/
Modify:
Batch replace simple_html_dom with CI_Simple_html_dom.
Place under applicationlibraries:
function index() { //$this->load->view('welcome_message'); $this->load->library('Simple_html_dom'); $html = file_get_html('http://localhost/test.htm'); foreach($html->find('a') as $e) echo $e->href . '<br>'; }
I hope this article will be helpful to everyone’s PHP programming based on Codeigniter.