add P-n to URL automatically, and be able to deal with only 1 page
This commit is contained in:
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);
|
||||
|
||||
Reference in New Issue
Block a user