php - get the URL to the last page of a webpage -
$doc = new domdocument(); libxml_use_internal_errors(true); @$doc->loadhtmlfile('http://www.mudah.my/malaysia/electronics-3000/directd-for-sale?o=1&q=directd&th=1'); $xpath = new domxpath($doc); $nlist = $xpath->query('//*[@id="list_ads_container"]/div[1]/div[3]/span[1]/a/div'); echo $nlist->item(0)->textcontent;
i'm trying url of lastly page of webpage, @ lastly word "last" , not url.
url set in href
attribute of <a>
. don't need select lastly <div>
, attribute content like
$nlist = $xpath->query('//*[@id="list_ads_container"]/div[1]/div[3]/span[1]/a'); $href = $nlist->item(0)->getattribute('href');
php html xpath html-content-extraction
No comments:
Post a Comment