Skip to content

Instantly share code, notes, and snippets.

@gloriousgeneralist
Created November 20, 2015 21:09
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Embed
What would you like to do?
Code4Lib Chicago LibCal API demo
<?php
$holidays = json_decode(file_get_contents('your unique URL with your own API key and other settings goes here'),true);
if (!empty($holidays['events'])) {
echo "<p>The library will be closed for the following:</p>\n
<ul>";
foreach($holidays['events'] as $event) {
$holiday_date = date('D. M. j', strtotime($event['start']));
echo '<li><strong>'.$holiday_date.'</strong> '.$event['title'].'</li>';
}
'</ul>';
}
?>
<?php
$today_array = json_decode(file_get_contents('https://api3.libcal.com/api_hours_today.php?iid=3076&lid=0&format=json'),true);
foreach($today_array['locations'] as $p)
{
if ($p['category']=='library') {
echo '<strong>'.$p['name'].'</strong>: '.$p['rendered'].' ';
}
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment