add P-n to URL automatically, and be able to deal with only 1 page

This commit is contained in:
2019-09-28 13:03:48 +02:00
parent c5679ba596
commit 52a572bfaf

View File

@@ -45,10 +45,14 @@ function immo_download($db) {
// get amount of available pages
$searchPages = $site->query('//div[@id="pageSelection"]/select');
$pages = $searchPages->item(0)->childNodes->length;
if($searchPages->length == 0) {
$pages=1;
} else {
$pages = $searchPages->item(0)->childNodes->length;
}
// create a dynamic url in which the current page number can be set in
$queryurldyn = str_replace("/P-1/", "/P-%page%/", $queryurl);
$queryurldyn = preg_replace("/\/Suche\//", "/Suche/P-%page%/", $queryurl);
// loop through available pages
for ($page = 1; $page <= $pages; $page++) {
$queryurlcur = str_replace("%page%", $page, $queryurldyn);