我想解析这个 html 页面,进行分页:
<div class="clear"></div>
<div id="ctl00_MainContent_PaperList_PageNavigator" class="page-navigator">
<a id="ctl00_MainContent_PaperList_Prev" title="Go to Previous Page" class="nextprev"
href="/Search?query=text%20summarization&s=0&start=1&end=10">Previous<a>
<a href="s=0&start=1&end=10">1</a> <span class="current">2</span>
<a id="ctl00_MainContent_PaperList_Next" title="Go to Next Page" class="nextprev"
href="/ Search?query=text%20summarization&s=0&start=21&end=30">Next</a>
<div>
对于上一页,我需要解析上一页并转到下一页。这是代码:
$html = file_get_html($url) or die ('');
if($link = $html->find('div[class=page-navigator] ')) {
$previous = $link->first_child()->href;
$next = $link->last_child()->href;
$html->clear();
unset($html);
// other process
}
我仍然收到错误Fatal error: Call to a member function first_child() on a non-object in D:\AppServ\www\coba\page\page1.php on line 18
怎么了。谢谢你 :)