Last active
June 19, 2021 00:27
-
-
Save skymeyer/1740f1a5237910a07606d01a02500934 to your computer and use it in GitHub Desktop.
Vatsim Controller Status Example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<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