for @all
the data is provided by csv-files.
@DBear provided a solution better then mine to read out the data and directly parse it it to json within php.
sample:
$url="http://wahlen.regioit.de/AC/LW12/05334002/html5/Landtagswahl_NRW3.csv";
$file = fopen($url,'r');
$all_rows = array();
$header = null;
while ( ($row = fgetcsv($file, 1200, ";") ) !== FALSE ) {
if ($header === null) {
$header = $row;
continue;
}
$all_rows[] = array_combine($header, $row);
}
$json = json_encode($all_rows);
print_r($json);
fclose($file);
i just did a curl to receive a string and parsed with js:
$csvUrl = $_POST['csvFile'];
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $csvUrl);
$agent= 'Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 1.0.3705; .NET CLR 1.1.4322)';
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_VERBOSE, true);
curl_setopt($ch, CURLOPT_USERAGENT, $agent);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, false);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 15); //time out of 15 seconds
$data = curl_exec($ch);
curl_close($ch);
regionAC_LTWNRW.hype.zip (160.7 KB)