better way with Simple HTML Dom Parser
<p>my HTML code is THE CODE IS REPEATED 16 times  : </p>

<pre><code>&lt;div class="headline_image"&gt;
&lt;a ga-cat="slideshow-view" ga-action="view-1" href="mylink"&gt;&lt;img src="http://dd4994.jpg" width="420" height="323" align="right" alt="my text "/&gt;&lt;/a&gt;
&lt;/div&gt;
</code></pre>

<p>I WANT TO GET all the imgs links and text also href what i did : </p>

<pre><code>for ($x = 0; $x &lt;=  15; $x++) {
$imglink = $html-&gt;find('div[class=headline_image] img', $x)-&gt;getAttribute('src');
$mytext = $html-&gt;find('div[class=headline_image] img', $x)-&gt;getAttribute('alt');
$postlink = $html-&gt;find('div[class=headline_image] a', $x)-&gt;getAttribute('href');
  echo '&lt;br/&gt;';
    echo $mytext;
     echo '&lt;br/&gt;';
    print_r($postlink);
    echo '&lt;br/&gt;';
    }
</code></pre>

<p>the code is slow any changes ?</p>