Created
December 13, 2016 17:27
-
-
Save witchica/ea8dd7297e1b2024a48dab545464292a 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
<?php | |
$my_var = file_get_contents("http://info.vroute.net/vatsim-data.txt"); | |
$pieces = explode("\n", $my_var); | |
$findme = "137"; | |
$users = array(); | |
foreach ($pieces as $s) { | |
$pos = strpos($s, $findme); | |
if ($pos == true) | |
{ | |
$record = explode(":", $s); | |
$user = array(); | |
$user["latitude"] = $record[getPos("latitude")]; | |
$user["longitude"] = $record[getPos("longitude")]; | |
array_push($users, $user); | |
} | |
} | |
function getPos($field) | |
{ | |
$fields = explode(":", "callsign:cid:realname:clienttype:frequency:latitude:longitude:altitude:groundspeed: | |
planned_aircraft:planned_tascruise:planned_depairport:planned_altitude:planned_destairport:server:protrevision: | |
rating:transponder:facilitytype:visualrange:planned_revision:planned_flighttype:planned_deptime:planned_actdeptime: | |
planned_hrsenroute:planned_minenroute:planned_hrsfuel:planned_minfuel:planned_altairport:planned_remarks:planned_route: | |
planned_depairport_lat:planned_depairport_lon:planned_destairport_lat:planned_destairport_lon:atis_message:time_last_atis_received: | |
time_logon:heading:QNH_iHg:QNH_Mb:4:5:6:7:8:"); | |
$max = sizeof($fields); | |
$ret = 0; | |
for ($i = 0; $i<$max; $i++) | |
{ | |
if ($fields[$i] == $field) | |
{ | |
$ret = $i; | |
} | |
} | |
return $ret; | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment