Skip to content

Instantly share code, notes, and snippets.

@blakecrosby
Last active August 29, 2015 14:19
Show Gist options
  • Save blakecrosby/deddd36fbefae24545da to your computer and use it in GitHub Desktop.
Save blakecrosby/deddd36fbefae24545da to your computer and use it in GitHub Desktop.
Command:
printf "live version 1.0 user dbrobert password xxxxx events "position"\n\n" | openssl s_client -host firehose.flightaware.com -port 1501 -quiet -tls1 | php test.php
test.php:
<?php
$f = fopen( 'php://stdin', 'r' );
while( $line = fgets( $f ) ) {
$data = json_decode($line);
if ($data->updateType !='Z') {
$delta = time() - $data->clock;
$position_time = gmdate("Y-m-d\TH:i:s\Z", $data->clock);
$current_time = gmdate("Y-m-d\TH:i:s\Z", time());
print "$position_time :: $current_time :: $delta " . $data->updateType . "\n";
}
}
fclose( $f );
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment