Compare commits

...

2 Commits

2 changed files with 11 additions and 13 deletions

View File

@@ -1,15 +1,9 @@
;<?php ;<?php die(); ?>
;die(); // For further security
;/*
[general] [general]
# "url" has to contain page indicator (/P-x/). This is not existent on the first search result page but can be added manually url = "https://www.immobilienscout24.de/Suche/S-T/Wohnung-Miete/Baden-Wuerttemberg/Konstanz-Kreis/Konstanz/2,00-/55,00-"
url = "https://www.immobilienscout24.de/Suche/S-2/P-1/Wohnung-Miete/Nordrhein-Westfalen/Koeln/70_6_118_39_20_101_2_50_11_56_120/2,00-3,00/-80,00/EURO--900,00/-/-/false/-/-/true/-/-/true"
db = "angebote.json" db = "angebote.json"
[mail] [mail]
to = "to@example.com" to = "me@example.com"
from = "from@example.com" from = "Immoscout Helper <noreply@example.com>"
;*/
;?>

View File

@@ -45,10 +45,14 @@ function immo_download($db) {
// get amount of available pages // get amount of available pages
$searchPages = $site->query('//div[@id="pageSelection"]/select'); $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 // 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 // loop through available pages
for ($page = 1; $page <= $pages; $page++) { for ($page = 1; $page <= $pages; $page++) {
$queryurlcur = str_replace("%page%", $page, $queryurldyn); $queryurlcur = str_replace("%page%", $page, $queryurldyn);