Skip to content

Instantly share code, notes, and snippets.

@skymeyer
Last active June 19, 2021 00:27
Show Gist options
  • Save skymeyer/1740f1a5237910a07606d01a02500934 to your computer and use it in GitHub Desktop.
Save skymeyer/1740f1a5237910a07606d01a02500934 to your computer and use it in GitHub Desktop.
Vatsim Controller Status Example
<?php
require_once 'vendor/autoload.php';
$vatsim = new \Vatsimphp\VatsimData();
$vatsim->loadData();
// List of positions you want to display.
$positions = ['PHL_ND_DEP', 'PVX_APP', 'CZQM_CTR'];
// Generate status for each position.
foreach ($positions as $position) {
$result = $vatsim->searchCallsign($position)->toArray();
if (count($result) > 0) {
echo sprintf("<p>Position %s <b>online</b> (%s)</p>\n", $position, $result[0]['realname']);
} else {
echo sprintf("<p>Position %s <b>offline</b></p>\n", $position);
}
}
<p>Position PHL_ND_DEP <b>online</b> (Mike Bencivenga)</p>
<p>Position PVX_APP <b>offline</b></p>
<p>Position CZQM_CTR <b>online</b> (Tim Murphy)</p>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment