コード例 #1
0
<?php

require_once './vendor/autoload.php';
$vatsim = new \Vatsimphp\VatsimData();
$vatsim->loadData();
コード例 #2
0
<?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";
}
コード例 #3
0
 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();
 }