Note that there are some explanatory texts on larger screens.

plurals
  1. POSimple HTML DOM nested trying to catch next
    primarykey
    data
    text
    <p>How would I retrieve the last occurence of a.page_arrows</p> <pre><code> &lt;div class="page-nav"&gt; &lt;a class="paginationNumberStyle page_arrows" data-url="/Building-Materials-Concrete-Cement-Masonry/h_d1/N-5yc1vZ25ecodZarlk/h_d2/Navigation?catalogId=10053&amp;amp;Nu=P_PARENT_ID&amp;amp;langId=-1&amp;amp;Nao=384&amp;amp;storeId=10051"&gt; &lt;img alt="" src="/static/images/layout/triangle-green-left.gif"&gt;&lt;/a&gt; &lt;span&gt;6&lt;/span&gt; &lt;a class="paginationNumberStyle" data-url="/Building-Materials-Concrete-Cement-Masonry/h_d1/N-5yc1vZ25ecodZarlk/h_d2/Navigation?catalogId=10053&amp;amp;Nu=P_PARENT_ID&amp;amp;langId=-1&amp;amp;Nao=576&amp;amp;storeId=10051"&gt;7&lt;/a&gt; &lt;a class="paginationNumberStyle" data-url="/Building-Materials-Concrete-Cement-Masonry/h_d1/N-5yc1vZ25ecodZarlk/h_d2/Navigation?catalogId=10053&amp;amp;Nu=P_PARENT_ID&amp;amp;langId=-1&amp;amp;Nao=672&amp;amp;storeId=10051"&gt;8&lt;/a&gt; &lt;a class="paginationNumberStyle page_arrows" data-url="/Building-Materials-Concrete-Cement-Masonry/h_d1/N-5yc1vZ25ecodZarlk/h_d2/Navigation?catalogId=10053&amp;amp;Nu=P_PARENT_ID&amp;amp;langId=-1&amp;amp;Nao=576&amp;amp;storeId=10051"&gt; &lt;img alt="" src="/static/images/layout/triangle-green-right.gif"&gt;&lt;/a&gt; &lt;/div&gt; </code></pre> <p>I am trying to collect links and then go to the next page and collect the rest of the links until there is no nest page. This is my code:</p> <pre><code> getLinks('http://www.homedepot.com/Building-Materials-Concrete-Cement-Masonry/h_d1/N-5yc1vZ25ecodZarlk/h_d2/Navigation?catalogId=10053&amp;Nu=P_PARENT_ID&amp;langId=-1&amp;storeId=10051&amp;currentPLP=true&amp;omni=c_Concrete,%20Cement%20&amp;%20Masonry&amp;searchNav=true'); function getLinks($URL) { $html = file_get_contents($URL); $dom = new simple_html_dom(); $dom -&gt; load($html); foreach ($dom-&gt;find('a[class=item_description]') as $href){ $url = $href-&gt;href; echo $url.'&lt;br&gt;'; } if ($nextPage = $dom-&gt;find("a[class=paginationNumberStyle]" ,0)){ $nextPageURL = 'http://www.homedepot.com'.$nextPage-&gt;getAttribute('data-url'); $dom -&gt; clear(); unset($dom); getLinks($nextPageURL); } else { echo "\nEND"; $dom -&gt; clear(); unset($dom); } } </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload