Get the first image in a page with class foo
<p>I'm trying to get the first image with specific class from page by php
<br></p>

<pre><code>&lt;?php
$document = new DOMDocument();
@$document-&gt;loadHTML(file_get_contents('http://www.cbsnews.com/8301-501465_162-57471379-501465/first-picture-on-the-internet-turns-20/'));
$lst = $document-&gt;getElementsByTagName('img');

for ($i=0; $i&lt;$lst-&gt;length; $i++) {
    $image = $lst-&gt;item($i);
    echo $image-&gt;attributes-&gt;getNamedItem('src')-&gt;value, '&lt;br /&gt;';
}
?&gt;
</code></pre>

<p>this code get all images from the page, i'm trying now to get the images with class "cnet-image" from <a href="http://www.cbsnews.com/8301-501465_162-57471379-501465/first-picture-on-the-internet-turns-20/" rel="nofollow">this page</a></p>
