Return to Snippet

Revision: 62887
at March 20, 2013 20:33 by haydin

Initial Code
$html = file_get_contents('');

$dom = new DOMDocument();

// 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 />';

Initial URL

Initial Description
Here's the basic principal behind spiders. (ex: <a href="">Giochi Flash</a> $html = file_get_contents('');

Initial Title
Find All Links on a Page

Initial Tags
php, link, page, links

Initial Language