使用DOMDocument抓取数据 并分类
http://smart-phones.biyixia.com/node/1013
<?php
/**
* Created by PhpStorm.
* User: Admin
* Date: 13-11-14
* Time: 下午10:42
*/
$link[]=array();
$page_url='http://smart-phones.biyixia.com/node/1013';
//$content=get_data($page_url);
$doc= new DOMDocument();
@$doc->loadHTMLFile($page_url);
$div_contents = $doc->getElementsByTagName('div');
print_r($div_contents);
foreach($div_contents as $div_content ){
$items = $div_content->getAttribute("class");
$itme_value = $items->nodeValue;
}
echo $items_value;