| Path : /var/www/html/tollfree-tracker/api/ |
| Current File : /var/www/html/tollfree-tracker/api/get-live-counts.php |
<?php
require_once getcwd().'/../define.php';
ini_set('display_errors', '1');
header('Content-Type:application/json');
$filter = [];
$options = ['sort' => ['last_updated' => -1], 'limit' => 1];
$data = $objMongoDb->getRecord('tollfree_updates', $filter, $options);
//print_r($data);
$latest_data = [];
foreach($data as $doc) {
$latest_data = $doc;
}
$latest_data = (array) $latest_data;
unset($latest_data['_id']);
print json_encode($latest_data);
?>