5
260
$html = file_get_contents('http://www.site.com'); $dom = new DOMDocument; $dom->loadHTML($html); $links = $dom->getElementsByTagName('a'); foreach ($links as $link){ echo $link->nodeValue; echo $link->getAttribute('href'), '<br>'; }