website/app/routes/shows.php
2015-08-30 12:34:43 -04:00

33 lines
955 B
PHP
Executable File

<?php
$app->get('/shows', function() use($app) {
$shows = json_decode(file_get_contents('http://api.bandsintown.com/artists/HALFtone/events.json?api_version=2.0&app_id=shows_halftoneband.com'));
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.php', [
'shows' => $shows,
]);
})->name('shows');
$app->get('/shows/json', function() use($app) {
$shows = json_decode(file_get_contents('http://api.bandsintown.com/artists/HALFtone/events.json?api_version=2.0&app_id=shows_halftoneband.com'));
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');