无法删除“查看源代码”中仍然可用的元素

时间:2014-12-17 07:23:24

标签: php simple-html-dom

我正在尝试废弃一个仍然可用的元素,查看源代码'但我没能实现它。

我也试过了cURL但是徒劳无功。

<div class="filter">
   <ul class="view-as">
      <li class="refine only-for-small facet-panel-trigger"><a href="#" rel="nofollow"><span class="hide-for-tiny">Filters</span></a></li>
      <li class="label hide-for-tiny">View as:</li>
      <li class="option view-as-grid">
         <span class="active">
         <span class="visuallyhidden">
         Grid
         </span>
         </span>
      </li>
      <li class="option view-as-list">
         <a href="/c/home/kitchenware/cookware/W404651?N=27fj&Nrpp=30&viewAs=list" rel="nofollow">
         <span class="visuallyhidden">List</span>
         </a>
      </li>
   </ul>
   <div class="pager-refine divided">
      <ul class="pager pager-pages">
         <li class="previous option">
         </li>
         <li class="label hide-for-small">
            <strong>Page 1</strong> of 2
         </li>
         <li class="next option">
            <a href="/c/home/kitchenware/cookware/W404651?N=27fj&Nrpp=30&viewAs=grid&page=1" title="Next Page">
            <span class="iconf iconf-right-arrow-large" aria-hidden="true" data-icon="&#xe601;"></span>
            </a>
         </li>
      </ul>
   </div>
</div>

我想获得<div class="pager-refine divided">但它返回空。

我在Chrome浏览器的查看源代码中找到了上述代码

#UPDATE 1

当我尝试以下代码时

echo $pagnationContent = $childPage->find("div.filter",0);

仅显示

    <div class="filter">
           <ul class="view-as">
              <li class="refine only-for-small facet-panel-trigger"><a href="#" rel="nofollow"><span class="hide-for-tiny">Filters</span></a></li>
              <li class="label hide-for-tiny">View as:</li>
              <li class="option view-as-grid">
                 <span class="active">
                 <span class="visuallyhidden">
                 Grid
                 </span>
                 </span>
              </li>
              <li class="option view-as-list">
                 <a href="/c/home/kitchenware/cookware/W404651?N=27fj&Nrpp=30&viewAs=list" rel="nofollow">
                 <span class="visuallyhidden">List</span>
                 </a>
              </li>
           </ul>
</div>

#UPDATE 2

function readThisPage($url){


ini_set('user_agent', 'Mozilla/5.0 (Windows NT 6.1; rv:5.0) Gecko/20100101 Firefox/5.0 FirePHP/0.5 ');

$context = stream_context_create (array ('http' => array ('timeout' => 60)));
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
curl_setopt ($ch, CURLOPT_HTTPHEADER, $curlHeaders);
curl_setopt ($ch, CURLOPT_CAINFO, dirname(__FILE__)."/cacert.pem");
$buffer = curl_exec($ch);
curl_close($ch);


return $buffer;


}

0 个答案:

没有答案