Last active
August 29, 2015 14:19
-
-
Save blakecrosby/deddd36fbefae24545da to your computer and use it in GitHub Desktop.
This file contains hidden or 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
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