PHP开发实例大全(提高卷) 中文完整pdf扫描版[244MB]
- $html = file_get_contents('http://www.example.com');
- $dom = new DOMDocument();
- @$dom->loadHTML($html);
- // grab all the on the page
- $xpath = new DOMXPath($dom);
- $hrefs = $xpath->evaluate("/html/body//a");
- for ($i = 0; $i < $hrefs->length; $i++) {
- $href = $hrefs->item($i);
- $url = $href->getAttribute('href');
- echo $url.'<br />';
- }
转载请注明:谷谷点程序 » php查找出网页中所有链接