website/app/routes/shows.php

33 lines
950 B
PHP
Raw Normal View History

2015-08-30 12:34:43 -04:00
<?php
2015-08-30 12:34:43 -04:00
$app->get('/shows', function() use($app) {
2015-08-30 12:34:43 -04:00
$shows = json_decode(file_get_contents('http://api.bandsintown.com/artists/HALFtone/events.json?api_version=2.0&app_id=shows_halftoneband.com'));
2015-08-30 12:34:43 -04:00
foreach ($shows as $show) {
$show->date = date('M dS', strtotime($show->datetime));
$show->day = date('D', strtotime($show->datetime));
$show->time = date('H:i', strtotime($show->datetime));
}
$app->render('shows.twig', [
2015-08-30 12:34:43 -04:00
'shows' => $shows,
]);
})->name('shows');
$app->get('/shows/json', function() use($app) {
2015-08-30 12:34:43 -04:00
$shows = json_decode(file_get_contents('http://api.bandsintown.com/artists/HALFtone/events.json?api_version=2.0&app_id=shows_halftoneband.com'));
2015-08-30 12:34:43 -04:00
foreach ($shows as $show) {
$show->date = date('M dS', strtotime($show->datetime));
$show->day = date('D', strtotime($show->datetime));
$show->time = date('H:i', strtotime($show->datetime));
print_r($show);
echo '<br /><br />';
}
die();
})->name('shows.json');