首頁 >後端開發 >php教程 >php应用xpath抽取网页超链接

php应用xpath抽取网页超链接

WBOY
WBOY原創
2016-06-13 10:56:161132瀏覽

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&#160;protected]') as $node){        $link = $node->nodeValue;        echo $link . "\n";}?>

陳述:
本文內容由網友自願投稿,版權歸原作者所有。本站不承擔相應的法律責任。如發現涉嫌抄襲或侵權的內容,請聯絡admin@php.cn