title: PHP DOM parsing to get to elements inside specific div id
body: <p>I have some html as follows:</p>
  
  <pre><code>&lt;div id="tvcap"&gt;
      &lt;div class="c" id="tads"&gt;
          &lt;ol&gt;
              &lt;li&gt;
                  &lt;div class="vsc vsta"&gt;
                      &lt;h3&gt;
                          &lt;a id="pa1" href=""&gt;
                          &lt;/a&gt;
                          &lt;a id="vpa1" href="http://www.link1.com"&gt;
                          Link 1 Text 1&lt;/a&gt;
                      &lt;/h3&gt;
  
                      &lt;div&gt;
                          &lt;div class="kv kva"&gt;
                              &lt;cite&gt;
                              www.link1.com&lt;/cite&gt;
                          &lt;/div&gt;
                      &lt;/div&gt;
  
                      &lt;span class="ac"&gt;Link 1 Text2&lt;/span&gt;
                  &lt;/div&gt;
              &lt;/li&gt;
  
              &lt;li&gt;
                  &lt;div class="vsc vsta"&gt;
                  &lt;h3&gt;
                  &lt;a id="pa2" href=""&gt;
                  &lt;/a&gt;
                  &lt;a id="vpa2" href="http://www.link2.com"&gt;Link 2 Text 1&lt;/a&gt;
                  &lt;/h3&gt;
  
                  &lt;div&gt;
                      &lt;div class="kv kva"&gt;
                      &lt;cite&gt;www.link2.com&lt;/cite&gt;
                      &lt;/div&gt;
                  &lt;/div&gt;
  
                  &lt;span class="ac"&gt;Link 2 Text 3&lt;/span&gt;
                  &lt;div&gt;
                  &lt;div class="oslk"&gt;
                  &lt;/div&gt;
                  &lt;/div&gt;
                  &lt;/div&gt;
              &lt;/li&gt;
          &lt;/ol&gt;
      &lt;/div&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>Potentially there will be an unknown number of the links&amp;texts, and I wish to iterate and be able to get to each link and text.</p>
  
  <p>I am using the <a href="http://simplehtmldom.sourceforge.net/" rel="nofollow">simple html dom parser</a>.</p>
  
  <p>I cannot find the command to get to the div id 'vpa1'.</p>
  
  <p>I tried this, but it returns nothing:</p>
  
  <pre><code>foreach($html-&gt;find('a') as $element) 
   if ($element-&gt;id == "vpa1") echo $element-&gt;href . '&lt;br&gt;';
  </code></pre>
  
  <p>How can I get to each link and text based on the id being vpa[$i] (vpa1, vpa2, etc).</p>