<?php require_once './vendor/autoload.php'; $vatsim = new \Vatsimphp\VatsimData(); $vatsim->loadData();
<?php require_once './vendor/autoload.php'; $logFile = './vendor/skymeyer/vatsimphp/app/logsusers.log'; $vatsim = new \Vatsimphp\VatsimData(); $vatsim->setConfig('cacheOnly', true); $vatsim->setConfig('logFile', $logFile); if ($vatsim->loadData()) { $info = $vatsim->getGeneralInfo()->toArray(); $voice = $vatsim->getVoiceServers()->toArray(); $servers = $vatsim->getServers()->toArray(); echo "{$info['connected_clients']}"; } else { echo "Cannot load data"; }
protected function prepareVatsim() { // Load VATSIM datafeed $vatsim = new Vatsimphp\VatsimData(); $vatsim->setConfig('forceDataRefresh', true); $vatsim->loadData(); $general = $vatsim->getGeneralInfo()->toArray(); $this->updateDate = Carbon::createFromTimestampUTC($general['update']); $this->nextUpdate = Carbon::instance($this->updateDate)->addMinutes($general['reload']); $this->pilots = $vatsim->getPilots()->toArray(); $this->controllers = $vatsim->getControllers()->toArray(); }