2012-11-25 131 views
0

我正在尝试为我的网站制作最新消息,如功能。对于这一点,我已经做了以下如何获取页面内容

$dom = new domDocument; 
@$dom->loadHTML(file_get_contents($url)); 
$dom->preserveWhiteSpaces = false; 
$linksToStore = $dom->getElementsByTagName('a'); 

foreach($linksToStore as $tag){ 
    $links[$tag->getAttribute('href')]= $tag->childNodes->item(0)->nodeValue; 
} 

我怎样才能获得内容不被那些与特定域的链接指向的网页做了一个网络爬虫,并具有能够收集来自网页链接起来到现在在我的情况下是'医疗'?

回答