Create list of all urls in my website

Hi. I want to create a list of urls in my website, rather like a Yahoo urllist.txt file. I have got thus far:

$html = file_get_contents($url);
$doc = new DOMDocument();
$xpath = new DOMXpath($doc);
$nodes = $doc->getElementsByTagName('a');

which has found 29 nodes - but how do I now get the href part? Or am I going about this completely the wrong way?!

Thanks guys

href is an attribute of <a>, so you need to use the getAttribute() method.

Cool, thanks @Dormilich - onwards and upwards.

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.