Codeigniter’s DOM class usage example
This article describes the Codeigniter DOM class usage example. 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/
Modification:
Replace simple_html_dom with CI_Simple_html_dom in batches.
Place it under applicationlibraries:
?
1
2
3
4
5
6
7
8
|
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 . ' ';
}
|
1
2
3
4
5
6
7
8
|
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 . ' ';
}
|
I hope this article will be helpful to everyone’s PHP programming based on Codeigniter.
http://www.bkjia.com/PHPjc/1022670.htmlwww.bkjia.comtruehttp: //www.bkjia.com/PHPjc/1022670.htmlTechArticleCodeigniter’s DOM class usage examples. This article describes the Codeigniter’s DOM class usage examples. Share it with everyone for your reference. The specific analysis is as follows: Using the simple_html_dom dom class to modify a CI...