From 5d9c9957622c83fc194eb9871ad5ff86faf67da6 Mon Sep 17 00:00:00 2001 From: Jason Williams Date: Sun, 19 Aug 2018 15:13:11 -0600 Subject: [PATCH] Added option to get calendar data - Changed ?data GET parameter to ?location - Added ?calendar GET parameter - Will fetch calendar data from internal.jnf.me --- www/where/index.php | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/www/where/index.php b/www/where/index.php index 64ab742..5ad22c8 100644 --- a/www/where/index.php +++ b/www/where/index.php @@ -1,5 +1,5 @@ array( 'method' => 'GET', @@ -18,6 +18,18 @@ echo json_encode($output['device_tracker.jasonsphone_jason']); exit(); + elseif (isset($_GET["calendar"])): + $options = array( + 'http' => array( + 'header' => 'Host: internal.jnf.me' + ) + ); + + $context = stream_context_create($options); + + header('Content-Type: application/json'); + echo file_get_contents("http://192.168.0.25/public/pages/display/calendar.php?location", false, $context); + else: ?> @@ -60,7 +72,7 @@ }); function updateLocation() { - $.getJSON('?data', function(data) { + $.getJSON('?location', function(data) { $('h1').html((data.state == 'not_home') ? 'Nobody Knows' : 'At ' + data.state.replace(/^\w/, c => c.toUpperCase())); var locLive = new google.maps.LatLng(data.attributes.latitude, data.attributes.longitude); map.setCenter(locLive);