Browse Source

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

master
max.mehl 2 years ago
parent
commit
52a572bfaf
Signed by: mxmehl GPG Key ID: 2704E4AB371E2E92
  1. 10
      index.php

10
index.php

@ -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);

Loading…
Cancel
Save