simple crawler in php to echo links
<p>I wanted to make a simple crawler in php that would let me get the links in a web page, echo their url, and crawl to other pages to do the same under a certain domain. Would using cURL be necessary here? Also..how would one specify depth of the crawler. </p>

<p>I have this so far :</p>

<pre><code>    $dom = new DOMDocument;
$dom-&gt;loadHTML($html);
foreach( $dom-&gt;getElementsByTagName('a') as $node ) {
    echo $dom-&gt;saveXml($node), PHP_EOL;
}
</code></pre>
