VatsimPHP Network Information



Vatsim Data
ATC: 43
Pilots: 302
Total: 345
Data Courtesy VatsimPHP
Click here to download this script!

VatsimPHP Links
- Home
- Download
- Examples
- Online Manual
- Partner Websites
- Contact Us

==================================================================================================================
==================================================================================================================
VatsimPHP v4.0.1 Documentation
Created by Brian Beach (915973)
Email: bbeach@bbflights.com
==================================================================================================================
For use by Vatsim-related websites only! Examples:
- Stats websites
- Virtual Airlines
- Virtual ATC Divisions
- Informational websites
- Etc.
==================================================================================================================
By using this software, you agree to give credit to VatsimPHP for the script. The credit() function can help ;)
==================================================================================================================
==================================================================================================================
;;;UPDATE HISTORY:::
==================================================================================================================
v4.0.1 (Feb 17, 2010)
- Complies with new Vatsim data URLs
------------------------------------------------------------------------------------------------------------------
v4.0.0 (Late 2008):
- Complete rewrite
- Function usage
- New VatsimPHP class
- New website
==================================================================================================================
==================================================================================================================
;;;INSTALLING VATSIMPHP v4.0:::
==================================================================================================================
Installing VatsimPHP is easy! To start, you must download the VatsimPHP files at http://www.bbflights.com/VatsimPHP/download.php. Extract either the ZIP or RAR files into the directory you wish to use VatsimPHP. VatsimPHP is now installed!
==================================================================================================================
==================================================================================================================
;;;IMPLIMENTING VATSIMPHP:::
==================================================================================================================
Okay, so you have VatsimPHP installed, right? If not, check the section entitled "Installing VatsimPHP v4.0". Once you have VatsimPHP installed, it is time to impliment the initial script into your PHP (4/5) file(s). The following script needs to be used at the beginning of every page that will utilize VatsimPHP:
-------------------------------------------------------------------------------------------------------------------
<?php
require_once("VatsimPHPgenerator.php");
$VatsimPHP=new VatsimPHP;
?>
-------------------------------------------------------------------------------------------------------------------
By doing so, you impliment the "VatsimPHP" class, which contains the entire VatsimPHP script. NOTE: You may replace "$VatsimPHP" with any variable, but do not change anything else. Throughout this manual, we will be using the $VatsimPHP variable.
==================================================================================================================
==================================================================================================================
;;;GETTING ALL ONLINE CLIENTS:::
==================================================================================================================
Now that you have started VatsimPHP with the implimentation script (see: "Implimenting VatsimPHP"), odds are that you want to view clients online. What kind of clients do you want to show on your website? If you just want to show every client online, with no filters, keep on reading this section. If you are an Air Traffic Control facility, or wish to show every Air Traffic Controller online, read the section entitled "Getting Air Traffic Controllers Online". If you wish to show pilots only, read the section entitled "Getting Pilots Online". However, if you are a Virtual Airline wishing to show only your airline's pilots, read the section entitled "Getting Airline Pilots Online".
==================================================================================================================
Now that we have that sorted out, it is time to get the list of clients online! The information is given in a multi-dimensional array, or listing. To download the information, use the following script:
-------------------------------------------------------------------------------------------------------------------
<?php
$clientlist
=$VatsimPHP->clients();
?>
-------------------------------------------------------------------------------------------------------------------
The list of clients online is now in the multi-dimensional array "$clientlist". Feel free to replace $clientlist with whatever you wish, but for purposes of documentation, we will continue to use $clientlist. Now, continue to the section entitled "Showing Requested Clients".
==================================================================================================================
==================================================================================================================
;;;GETTING AIR TRAFFIC CONTROLLERS ONLINE:::
==================================================================================================================
Okay, you have implimented the starting script for VatsimPHP (see "Implimenting VatsimPHP"), and are ready to view all Air Traffic Controllers online. To download a list of all Air Traffic Controllers, use the following script:
-------------------------------------------------------------------------------------------------------------------
<?php
$clientlist
=$VatsimPHP->controllers();
?>
-------------------------------------------------------------------------------------------------------------------
The list of Air Traffic Controllers online is now in the multi-dimensional array "$clientlist". Feel free to replace $clientlist with whatever you wish, but for purposes of documentation, we will continue to use $clientlist. Now, continue to the section entitled "Showing Requested Clients".
==================================================================================================================
==================================================================================================================
;;;GETTING PILOTS ONLINE:::
==================================================================================================================
Okay, you have implimented the starting script for VatsimPHP (see "Implimenting VatsimPHP"), and we are ready to view all Pilots online. To download a list of all Pilots, use the following script:
-------------------------------------------------------------------------------------------------------------------
<?php
$clientlist
=$VatsimPHP->pilots();
?>
-------------------------------------------------------------------------------------------------------------------
The list of Pilots online is now in the multi-dimensional array "$clientlist". Feel free to replace $clientlist with whatever you wish, but for purposes of documentation, we will continue to use $clientlist. Now, continue to the section entitled "Showing Requested Clients".
==================================================================================================================
==================================================================================================================
;;;GETTING AIRLINE PILOTS ONLINE:::
==================================================================================================================
Okay, you have implimented the starting script for VatsimPHP (see "Implimenting VatimPHP"), and we are ready to view all Airline pilots online. There is one big question: will this page be representing a single or multiple airlines? If you are representing a single airline, use the following script (NOTE: "BAW" is used as the airline's three-digit identifier. Replace this with your airline's identifier):
-------------------------------------------------------------------------------------------------------------------
<?php
$clientlist
=$VatsimPHP->airline("BAW");
?>
-------------------------------------------------------------------------------------------------------------------
If the webpage will represent multiple airlines, you must use an array to get them all. To gather the information, use the following script (NOTE: "AFA" and "PAY" are used in this example. Replace them with your airlines' three-digit identifiers. You may also add as many array entries as needed):
-------------------------------------------------------------------------------------------------------------------
<?php
$clientlist
=$VatsimPHP->airline(array("AFA", "PAY"));
?>
-------------------------------------------------------------------------------------------------------------------
The list of Airline Pilots online is now in the multi-dimensional array "$clientlist". Feel free to replace $clientlist with whatever you wish, but for purposes of documentation, we will continue to use $clientlist. Now, continue to the section entitled "Showing Requested Clients".
==================================================================================================================
==================================================================================================================
;;;SHOWING REQUESTED CLIENTS:::
==================================================================================================================
Now that you have a list of clients (check your respective section), you probably want to show them on your webpage. You obviously need some knowledge in PHP, specifically in arrays. However, here is a sample script showing requested clients online:
-------------------------------------------------------------------------------------------------------------------
<TABLE>
<TR>
<TD><B><U>Callsign</U></B></TD>
<TD><B><U>Real Name:</U></B></TD>
</TR>
<?php
foreach($clientlist as $client)
    {
        echo
"<TR>";
        echo
"<TD>".$client[0]."</TD>";
        echo
"<TD>".$client[2]."</TD>";
        echo
"</TR>";
    }
?>
</TABLE>
-------------------------------------------------------------------------------------------------------------------
This may seem confusing at first, but this is a pretty basic script. To understand the array better:
-------------------------------------------------------------------------------------------------------------------
$clientlist = array(
    "CLIENT1" => array(
        "0" => "CALLSIGN",        -The callsign of the client. It's the name the client is recognized on the network
        "1" => "CID"            -The personal CID of the client. The CID is the unique code assigned by Vatsim to every registered user
        "2" => "REALNAME",        -The realname of the user connected.
        "3" => "CLIENTTYPE"        -May be ATC or PILOT. Determines which array the user is in.
        "4" => "FREQUENCY"        -The frequency the client is tuned to. For Air Traffic Controllers only.
        "5" => "LATITUDE"        -The current latittude of the position of the pilot. For Pilots only.
        "6" => "LONGITUDE"        -The current longitude of the position of the pilot. For Pilots only.
        "7" => "ALTITUDE"        -The current altitude in feed of the pilot. For Pilots only.
        "8" => GROUNDSPEED"        -The current groundspeed of the pilot. For Pilots only.
        "9" => "PLANNED_AIRCRAFT"    -The aircraft type put into flight plan by the pilot. Only for pilots that have submitted a flight plan.
        "10" => "PLANNED_TASCRUISE"    -The true airspeed put into flight plan by the pilot. Only for pilots that have submitted a flight plan.
        "11" => "PLANNED_DEPAIRPORT"    -ICAO code of the departure airport put into flight plan by the pilot. Only for pilots that have submitted a flight plan.
        "12" => "PLANNED_ALTITUDE"    -The altitude put into flight plan by the pilot. Only for pilots that have submitted a flight plan.
        "13" => "PLANNED_DESTAIRPORT"    -The destination airport put into flight plan by the pilot. Only for pilots that have submitted a flight plan.
        "14" => "SERVER"        -The server name to which the client is connected.
        "15" => "PROTREVISION"        -The protocol number revision used by the client.
        "16" => "RATING"        -The rating of the user connected.
            1 - Pilot/Observer
            2 - Student
            3 - Senior Student (3 and 4 are the same)
            4 = Senior Student
            5 - Controller
            6 - Senior Controller (6 and 7 are the same)
            7 - Senior Controller
            8 - Instructor
            9 - Senior Instructor (9 and 10 are the same)
            10 - Senior Instructor
            11 - Supervisor
            12 - Administrator
        "17" => "TRANSPONDER"        -The squawk code set by client. For Pilots only.
        "18" => "FACILITYTYPE"        - Type of facility controlled by an ATC. For Controllers only.
            0 - Observer
            1 - Flight Service Station
            2 - Clearance Delivery
            3 - Ground
            4 - Tower
            5 - Approach/Departure
            6 - Center
        "19" => "VISUALRANGE"        -Range of visibility set by a ATC. For Controllers only.
        "20" => "PLANNED_REVISION"    -Revision of flight plan submitted. Only for pilots that have submitted a flight plan.
        "21" => "PLANNED_FLIGHTTYPE"    -Type of flight plan submitted. Only for pilots that have submitted a flight plan.
            I - IFR
            V - VFR
            S - S/VFR
        "22" => "PLANNED_DEPTIME"    -The departure time put into flight plan by the pilot. Only for pilots that have submitted a flight plan.
        "23" => "PLANNED_ACTDEPTIME"    -The actual departure time put into flight plan by the pilot. Only for pilots that have submitted a flight plan.
        "24" => "PLANNED_HRSENROUTE"    -The hours enroute put into flight plan by the pilot. Only for pilots that have submitted a flight plan.
        "25" => "PLANNED_MINENROUTE"    -The minutes enroute put into flight plan by the pilot. Only for pilots that have submitted a flight plan.
        "26" => "PLANNED_HRSFUEL"    -The hours of fuel loaded put into flight plan by the pilot. Only for pilots that have submitted a flight plan.
        "27" => "PLANNED_MINFUEL"    -The minutes of fuel loaded put into flight plan by the pilot. Only for pilots that have submitted a flight plan.
        "28" => "PLANNED_ALTAIRPORT"    -ICAO code of the alternate airport put into flight plan by the pilot. Only for pilots that have submitted a flight plan.
        "29" => "PLANNED_REMARKS"    -The rmarks put into flight plan by the pilot. Only for pilots that have submitted a flight plan.
        "30" => "PLANNED_ROUTE"        -The flight plan submitted by the pilot. Only for pilots that have submitted a flight plan.
        "35" => "ATIS_MESSAGE"        -Client ATIS Message. For Controllers only.
        "37" => "TIME_LOGON"        -It's the date/time the user logged on. The format is yyyymmddhhnnss.
        "38" => "HEADING"        -The current aircraft heading. For Pilots only.
        "39" => "QNH_iHg"        -QNH of the aircraft position, expressed in Hg inches.
        "40" => "QNH_Mb"        -QNH of the aircraft position, expressed in Millibars.
        )
    "CLIENT2" => array(
        "0" => "CALLSIGN"
        "1" => "CID"
        "2" => "REALNAME
        "3" => "CLIENTTYPE"
        "4" => "FREQUENCY"
        "5" => "LATITUDE"
        "6" => "LONGITUDE"
        "7" => "ALTITUDE"
        "8" => GROUNDSPEED"
        "9" => "PLANNED_AIRCRAFT"
        "10" => "PLANNED_TASCRUISE"
        "11" => "PLANNED_DEPAIRPORT"
        "12" => "PLANNED_ALTITUDE"
        "13" => "PLANNED_DESTAIRPORT"
        "14" => "SERVER"
        "15" => "PROTREVISION"
        "16" => "RATING"
        "17" => "TRANSPONDER"
        "18" => "FACILITYTYPE"
        "19" => "VISUALRANGE"
        "20" => "PLANNED_REVISION"
        "21" => "PLANNED_FLIGHTTYPE"
        "22" => "PLANNED_DEPTIME"
        "23" => "PLANNED_ACTDEPTIME"
        "24" => "PLANNED_HRSENROUTE"
        "25" => "PLANNED_MINENROUTE"
        "26" => "PLANNED_HRSFUEL"
        "27" => "PLANNED_MINFUEL"
        "28" => "PLANNED_ALTAIRPORT"
        "29" => "PLANNED_REMARKS"
        "30" => "PLANNED_ROUTE"
        "35" => "ATIS_MESSAGE"
        "37" => "TIME_LOGON"
        "38" => "HEADING"
        "39" => "QNH_iHg".
        "40" => "QNH_Mb"
        )
    "CLIENT3" => array(
        "0" => "CALLSIGN"
        "1" => "CID"
        "2" => "REALNAME
        "3" => "CLIENTTYPE"
        "4" => "FREQUENCY"
        "5" => "LATITUDE"
        "6" => "LONGITUDE"
        "7" => "ALTITUDE"
        "8" => GROUNDSPEED"
        "9" => "PLANNED_AIRCRAFT"
        "10" => "PLANNED_TASCRUISE"
        "11" => "PLANNED_DEPAIRPORT"
        "12" => "PLANNED_ALTITUDE"
        "13" => "PLANNED_DESTAIRPORT"
        "14" => "SERVER"
        "15" => "PROTREVISION"
        "16" => "RATING"
        "17" => "TRANSPONDER"
        "18" => "FACILITYTYPE"
        "19" => "VISUALRANGE"
        "20" => "PLANNED_REVISION"
        "21" => "PLANNED_FLIGHTTYPE"
        "22" => "PLANNED_DEPTIME"
        "23" => "PLANNED_ACTDEPTIME"
        "24" => "PLANNED_HRSENROUTE"
        "25" => "PLANNED_MINENROUTE"
        "26" => "PLANNED_HRSFUEL"
        "27" => "PLANNED_MINFUEL"
        "28" => "PLANNED_ALTAIRPORT"
        "29" => "PLANNED_REMARKS"
        "30" => "PLANNED_ROUTE"
        "35" => "ATIS_MESSAGE"
        "37" => "TIME_LOGON"
        "38" => "HEADING"
        "39" => "QNH_iHg".
        "40" => "QNH_Mb"
        )
    )
-------------------------------------------------------------------------------------------------------------------
Feel free to sort the array as much as needed. VatsimPHP will not provide support based on inadequate knowledge of PHP. The PHP manual is available at http://www.php.net/manual/.
===================================================================================================================
===================================================================================================================
;;;GETTING AN AIRPORT'S INFORMATION:::
===================================================================================================================
To get the information for a specific airport, use the following function (NOTE: KDTW is used for example purposes only):
-------------------------------------------------------------------------------------------------------------------
<?php
$airportinfo
=$VatsimPHP->airport("KDTW");
?>
-------------------------------------------------------------------------------------------------------------------
In this example, $airportinfo is now a single-dimentional array. For better understanding:
-------------------------------------------------------------------------------------------------------------------
$airportinfo=array(
    "0" => "KDTW"                    -The ICAO Identifier for the airport
    "1" => "Detroit Metropolitan Wayne County MI"    -The airport's name
    "2" => "+042.212058-083.348836"            -The airport's location (decimal)
    "3" => "DTW"                    -The three-letter identifier for the airport
    "4" => "KZOB"                    -The ARTCC/FIR/vACC in control of the airport
    )
-------------------------------------------------------------------------------------------------------------------
If you just want the name of the airport, use the following function (NOTE: KDTW is used for example purposes only):
-------------------------------------------------------------------------------------------------------------------
<?php
echo $VatsimPHP->airportname("KDTW");
?>
-------------------------------------------------------------------------------------------------------------------
The previous example would result in "Detroit Metropolitan Wayne County MI".
===================================================================================================================
===================================================================================================================
;;;GETTING AN AIRPORT'S WEATHER REPORT:::
===================================================================================================================
This is probably the easiest thing to do in VatsimPHP. To get a weather report, use the following function (NOTE: KDTW is used for example purposes only):
-------------------------------------------------------------------------------------------------------------------
<?php
echo $VatsimPHP->metar("KDTW");
?>
-------------------------------------------------------------------------------------------------------------------
The previous example would result in the current METAR report for KDTW.
===================================================================================================================
===================================================================================================================
;;;GIVING CREDIT WHERE CREDIT IS DUE:::
===================================================================================================================
VatsimPHP requires noting somewhere on the page that the data came from VatsimPHP, preferrably below where the data is shown. To do so, place the following function where you see fit:
-------------------------------------------------------------------------------------------------------------------
<?php
echo $VatsimPHP->credit();
?>
-------------------------------------------------------------------------------------------------------------------
The prevous example results in the following HTML code:
-------------------------------------------------------------------------------------------------------------------
Data Courtesy <A HREF="http://www.bbflights.com/VatsimPHP/">VatsimPHP</A>.
===================================================================================================================
===================================================================================================================
If you have any questions or concerns, email Brian Beach at bbeach[at]bbflights[dot]com. Blue skies!

©2009 Brian Beach. The VATSIM name, logo and network data are © The Virtual Air Traffic Simulation Network. VatsimPHP is not officially endorsed by the Vatsim network.