Compare commits

..

4 Commits

3 changed files with 13 additions and 13 deletions

1
.htaccess Normal file
View File

@@ -0,0 +1 @@
RedirectMatch 404 /\.git

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);
@@ -172,6 +176,7 @@ function immo_show($db) {
<style type="text/css"> <style type="text/css">
table { table {
border-collapse: collapse; border-collapse: collapse;
width: 100%;
} }
table, th, td { table, th, td {
border: 1px solid orange; border: 1px solid orange;