Reputation: 53
I am trying to use Simple HTML DOM to catch the last part of this pagination. This part:
<a class="paginationNumberStyle page_arrows" data-url="**/Building-Materials/h_d1/N-5yc1vZ25ecodZaqns/h_d2/Navigation?catalogId=10053&Nu=P_PARENT_ID&langId=-1&Nao=96&storeId=10051**">
<div class="page-nav">
<span>1</span>
<a class="paginationNumberStyle" data-url="/Building-Materials/h_d1/N-5yc1vZ25ecodZaqns/h_d2/Navigation?catalogId=10053&Nu=P_PARENT_ID&langId=-1&Nao=96&storeId=10051">
2
</a>
<a class="paginationNumberStyle" data-url="/Building-Materials/h_d1/N-5yc1vZ25ecodZaqns/h_d2/Navigation?catalogId=10053&Nu=P_PARENT_ID&langId=-1&Nao=192&storeId=10051">
3
</a>
<a class="paginationNumberStyle" data-url="/Building-Materials/h_d1/N-5yc1vZ25ecodZaqns/h_d2/Navigation?catalogId=10053&Nu=P_PARENT_ID&langId=-1&Nao=288&storeId=10051">
4
</a>
<a class="paginationNumberStyle" data-url="/Building-Materials/h_d1/N-5yc1vZ25ecodZaqns/h_d2/Navigation?catalogId=10053&Nu=P_PARENT_ID&langId=-1&Nao=384&storeId=10051">
5
</a>
<a class="paginationNumberStyle page_arrows" data-url="/Building-Materials/h_d1/N-5yc1vZ25ecodZaqns/h_d2/Navigation?catalogId=10053&Nu=P_PARENT_ID&langId=-1&Nao=96&storeId=10051">
<img alt="" src="/static/images/layout/triangle-green-right.gif"></a>
</div>
Here is my code:
if ($nextPage = $dom->find('a[class=paginationNumberStyle.page_arrows]', 0)) {
echo $nextPage->href;
I have also tried:
if ($nextPage = $dom->find('a[class=paginationNumberStyle.page_arrows]', 0)) {
I am far from an expert on Simple HTML DOM and was hoping that someone knew a quick answer. I am wondering if it is because of the data-url?
Upvotes: 0
Views: 941
Reputation: 2970
Try as this
if ($nextPage = $dom->find("a[class='paginationNumberStyle page_arrows]", 0)) echo $nextPage->getAttribute('data-url');
Upvotes: 1