Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
_*
data/*
config.php
cache/*
config.php
9 changes: 6 additions & 3 deletions dkb-crawl.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@
require('simple_html_dom.php');
require('config.php');

$cachedir='cache';
$url = 'https://www.dkb.de/';
$cachedir = __DIR__.'/'.$cachedir.'/'; //make it relative to current dir
define('CSV_HEADER_LINES', 7);
define('CSV_EC_COLUMN_DATE', 0);
define('CSV_EC_COLUMN_DATE2', 1);
Expand Down Expand Up @@ -60,8 +62,8 @@ function findLineInCSV($line, $csv) {
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_COOKIESESSION, true);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($ch, CURLOPT_COOKIEFILE, 'data/cookie.txt');
curl_setopt($ch, CURLOPT_COOKIEJAR, 'data/cookie.txt');
curl_setopt($ch, CURLOPT_COOKIEFILE, $cachedir.'/cookie.txt');
curl_setopt($ch, CURLOPT_COOKIEJAR, $cachedir.'/cookie.txt');
//curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
curl_setopt($ch, CURLOPT_CAINFO, 'cacert.pem');

Expand Down Expand Up @@ -148,7 +150,8 @@ function findLineInCSV($line, $csv) {
$cnt = 0;
$lines = explode("\n", $account['csv']);

$exists = file_exists($file = __DIR__ . '/data/' . $account['nr']);
if(!is_dir($cachedir)) mkdir($cachedir);
$exists = file_exists($file = $cachedir.$account['nr']);
$csv = $exists? file($file, FILE_IGNORE_NEW_LINES) : false;
file_put_contents($file, $account['csv']);
if (!$exists) {
Expand Down