Home > Backend Development > PHP Tutorial > php应用xpath抽取网页超链接

php应用xpath抽取网页超链接

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-06-13 10:56:16
Original
1167 people have browsed it

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";}?>
Copy after login

Related labels:
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Issues
python - how to use variables in xpath
From 1970-01-01 08:00:00
0
0
0
A little question about xpath in Python
From 1970-01-01 08:00:00
0
0
0
XPath locates text between two tags
From 1970-01-01 08:00:00
0
0
0
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template