Files
Matt Fiscus bdadea3cd1 Fixed timezone issue
Found an issue where timezone could be incorrect in api if server admin changes server timezeone to localtime instead of UTC.
2023-11-28 17:32:08 -07:00

36 lines
1.0 KiB
PHP

<?php
/*** Add stations to payload ***/
for ($i=0;$i<$Reflector->StationCount();$i++) {
$tmp = preg_split('/\s+/', $Reflector->Stations[$i]->GetCallSign(), -1, PREG_SPLIT_NO_EMPTY);
$Callsign = $tmp[0];
$tmp = preg_split('/\s+/', $Reflector->Stations[$i]->GetVia(), -1, PREG_SPLIT_NO_EMPTY);
$CallsignSuffix = $tmp[1];
// craft payload array
$payload['stations'][$i] = array(
'callsign' => $Callsign,
'callsignsuffix' => $CallsignSuffix,
'vianode' => $Reflector->Stations[$i]->GetVia(),
'onmodule' => $Reflector->Stations[$i]->GetModule(),
'lastheard' => gmdate('Y-m-d\TH:i:sp', $Reflector->Stations[$i]->GetLastHeardTime())
);
list ($CountryCode, $Country) = $Reflector->GetFlag($Reflector->Stations[$i]->GetCallSign());
$payload['stations'][$i]['country'] = array (
'country' => $Country,
'countrycode' => $CountryCode
);
}
// json encode payload array
$records = json_encode($payload);
echo $records;
?>