`
baiyuxiong
  • 浏览: 174943 次
  • 性别: Icon_minigender_1
  • 来自: 西安
社区版块
存档分类
最新评论

simple_html_dom 采集网页

    博客分类:
  • php
阅读更多
//$this->load->view('welcome_message');
		$this->load->library('Simple_html_dom');
		
		$html = file_get_html('http://localhost/test/reg.htm');
		foreach($html->find('.single_block ul.company_info') as $e)
		{
			echo $e->plaintext;
		}


递进搜索
//$this->load->view('welcome_message');
		$this->load->library('Simple_html_dom');
		
		$html = file_get_html('http://localhost/test/reg.htm');
		foreach($html->find('.single_block ul.company_info li') as $e)
		{
			echo $e->find('.gray',0)->plaintext;
		}
分享到:
评论
3 楼 wxhlwd 2012-07-11  
为什么load之后,页面报错说是没有找到simple_html_dom
2 楼 baiyuxiong 2010-09-18  
sentryward 写道
选择器有jquery强大吗?~。~

我觉得差不多强大,可以根据样式名称、ID、属性等选择,还能选子节点,父节点等。差不多够用了。
1 楼 sentryward 2010-09-18  
选择器有jquery强大吗?~。~

相关推荐

Global site tag (gtag.js) - Google Analytics