123456789101112131415161718192021222324 |
- <?php
- require __DIR__ . '/vendor/autoload.php';
- $url = 'https://www.yr.no/place/Norway/Troms/Tromsø/Tromsø/forecast_hour_by_hour.xml';
- $forecast = new App\Yr\Forecast($url);
- echo '<pre>';
- $range = $forecast->getTabular()->getBetween(
- $forecast->getSunset(), $forecast->getSunrise()->add(new \DateInterval('P1D'))
- );
- foreach ($range as $time)
- echo $time . "\n";
- echo "\n<hr />\n";
- foreach ($range->getVariations()->getData() as $data)
- echo sprintf("%s: %s\n", $data['time']->getFrom()->format("H:i"), join(", ", $data['entities']));
- echo "\n";
- foreach ($forecast->getCredit() as $c)
- echo $c . "\n";
- ?>
|