ref: 161e88895a382409bbb3c332bc2f904026d87e43
converter/gtfs.php
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
<?php require 'vendor/mustangostang/spyc/Spyc.php'; $metadata = Spyc::YAMLLoad('metadata.yml'); $today = date('Ymd'); $current = ''; $sizeU = ''; $sizeC = ''; foreach($metadata as $row) { $start = $row['start']; $end = $row['end']; if ($start <= $today and $today <= $end) { $current = $row['id']; $sizeU = $row['size_uncompressed']; $sizeC = $row['size_compressed']; break; } } unset($row); $etag = $_SERVER['HTTP_ETAG']; if ($etag == $current) { http_response_code(304); } else { header("ETag: $current"); // todo send file echo $current; } ?> |