贴上链接
http://www.ecartchina.com/php-simple-html-dom/manual.htm
//使用url和file都可以创建DOM
$html = file_get_html('http://www.google.com/');
//找到所有图片
foreach($html->find('img') as $element)
echo $element->src . '<br>';
//找到所有链接
foreach($html->find('a') as $element)
echo $element->href . '<br>';
// Find all anchors, returns a array of element objects 找到所有的a标签,返回一个 数组元素对象
$ret = $html->find('a');
// Find (N)th anchor, returns element object or null if not found (zero based) 找到第n个开始的a标签 , 返回数组 或者 null(如果没有找到的)
$ret = $html->find('a', 0);
// Find lastest anchor, returns element object or null if not found (zero based)
$ret = $html->find('a', -1);
// Find all <div> with the id attribute
$ret = $html->find('div[id]');
// Find all <div> which attribute id=foo
$ret = $html->find('div[id=foo]');
// 查找所有id=foo的元素
$ret = $html->find('#foo');
// 查找所有class=foo的元素
$ret = $html->find('.foo');
// 查找所有拥有 id属性的元素
$ret = $html->find('*[id]');
// 查找所有 anchors 和 images标记
$ret = $html->find('a, img');
// 查找所有有"title"属性的anchors and images
$ret = $html->find('a[title], img[title]');