php使用xpath抽取网页超链接
<?php$html=file_get_contents('http://www.163.com/');$doc=new DomDocument();$doc->loadHTML($html);$xpath=new DOMXpath($doc);foreach($xpath->query([email protected]') as $node){ $link = $node->nodeValue; echo $link . "\n";}?>