douyiyi5284 2013-03-03 21:04
浏览 34
已采纳

simple-html-dom嵌套

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&amp;Nu=P_PARENT_ID&amp;langId=-1&amp;Nao=96&amp;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&amp;Nu=P_PARENT_ID&amp;langId=-1&amp;Nao=96&amp;storeId=10051"> 
                    2
                 </a>

                 <a class="paginationNumberStyle" data-url="/Building-Materials/h_d1/N-5yc1vZ25ecodZaqns/h_d2/Navigation?catalogId=10053&amp;Nu=P_PARENT_ID&amp;langId=-1&amp;Nao=192&amp;storeId=10051"> 
                    3
                 </a>

                 <a class="paginationNumberStyle" data-url="/Building-Materials/h_d1/N-5yc1vZ25ecodZaqns/h_d2/Navigation?catalogId=10053&amp;Nu=P_PARENT_ID&amp;langId=-1&amp;Nao=288&amp;storeId=10051"> 
                    4
                 </a>

                 <a class="paginationNumberStyle" data-url="/Building-Materials/h_d1/N-5yc1vZ25ecodZaqns/h_d2/Navigation?catalogId=10053&amp;Nu=P_PARENT_ID&amp;langId=-1&amp;Nao=384&amp;storeId=10051"> 
                    5
                 </a>

        <a class="paginationNumberStyle page_arrows" data-url="/Building-Materials/h_d1/N-5yc1vZ25ecodZaqns/h_d2/Navigation?catalogId=10053&amp;Nu=P_PARENT_ID&amp;langId=-1&amp;Nao=96&amp;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?

  • 写回答

2条回答 默认 最新

  • dtt5830659 2013-03-04 00:47
    关注

    For simplicity you can just:

    $dom->find("a.page_arrows", 0)
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 求差集那个函数有问题,有无佬可以解决
  • ¥15 【提问】基于Invest的水源涵养
  • ¥20 微信网友居然可以通过vx号找到我绑的手机号
  • ¥15 寻一个支付宝扫码远程授权登录的软件助手app
  • ¥15 解riccati方程组
  • ¥15 display:none;样式在嵌套结构中的已设置了display样式的元素上不起作用?
  • ¥15 使用rabbitMQ 消息队列作为url源进行多线程爬取时,总有几个url没有处理的问题。
  • ¥15 Ubuntu在安装序列比对软件STAR时出现报错如何解决
  • ¥50 树莓派安卓APK系统签名
  • ¥65 汇编语言除法溢出问题