Jump to content

Aircraft used in PIREPS [SOLVED]


Recommended Posts

  • Moderators
Posted

Hello there,

I'm trying to insert the aircraft used in flight into PIREPS table. I was wondering what would be the xml variable for aircraft in kACARS. Thanks

:D

  • Members
Posted

for example in this module whe want to validate the user so the link will be

www.yoursite.com/action.php/nameofmodule?data=verify&pilotID=yourpilotid&password=yourpilotpassword

$case = strtolower($this->get->data);
 switch($case)
 {			
	 case 'verify':	
		 $results = Auth::ProcessLogin($this->get->pilotID, $this->get->password);	
		 if ($results)
		 {					
			 echo '1';
		 }
		 else
		 {
			 echo '0';
		 }

so if pilot has been validated it will return 1 or else it will return 0 this result i have a webrequest in vb that grabs it and resolves it to whatever i need

  • Moderators
Posted

I want to get the aircraft used in kACARS client and insert it into PIREPS table aircraft column or basically update the aircraft column of PIREPS table. :)

Guest lorathon
Posted

The aircraft should be inserted into the pireps table using the registration number. This number is either populated with the schedule that is loaded from the site. Or it can be changed, depending on the version, with the charter function or the aircraft selection drop down menu.

Relevant code

# Get aircraft information
$reg = trim($xml->pirep->registration);
$ac = OperationsData::GetAircraftByReg($reg);

  • Moderators
Posted

That's correct but is there a way to pull that aircraft from the recorded flight like the below log line?

08:34] Aircraft Title - Beech Baron 58 Paint1
  • Members
Posted

if i am mistaken lorathon please correct me but in the free version i don't think it is possible as the xml exports only the aircraft registration

if you go to C:\Program Files\FS-Products\kACARS_Free you will see the send.xml and there after you have made a flight you will see the format that it is being send .

For example this is mine after a flight

<?xml version="1.0" encoding="utf-8"?>
<!--kACARS-->
<kACARS>
<switch>
<data>getFlight</data>
</switch>
<verify>
<pilotID>GSA108</pilotID>
<password>-------</password>
<lang>English</lang>
</verify>
<liveupdate>
<pilotID>GSA108</pilotID>
<flightNumber />
<registration>SX-LFK</registration>
<latitude>36,3902892121747</latitude>
<longitude>28,1184499661445</longitude>
<heading>258</heading>
<altitude>0</altitude>
<route>VFR</route>
<groundSpeed>0</groundSpeed>
<depICAO />
<arrICAO />
<depTime />
<status />
</liveupdate>
<pirep>
<pilotID>GSA108</pilotID>
<flightNumber />
<registration>SX-LFK</registration>
<depICAO />
<arrICAO />
<flightTime />
<flightType>H</flightType>
<fuelUsed />
<pax />
<cargo />
<landing />
<comments />
<log />
</pirep>
</kACARS>

so as you can see in the pirep root element only the <registration>SX-LFK</registration> is being send

Best regards

Guest lorathon
Posted

Parkho,

If you wish to grab the aircraft title then just loop through the log and locate it. Pretty easy to do.

Loop through each line and look for the "Aircraft Title". Once found explode the string and grab the part you want to use. Then you can use this data for whatever you wish.

Example

$log = explode('*', $xml->pirep->log);

foreach($log as $line) {
 if (strpos($line, "Aircraft Title") !== false) {
   $temp = $line;
   break;
 }
}

$temp = explode('-', $title);

$title = $temp[1];

NOTE: Not tested but should work

  • Moderators
Posted

Parkho,

If you wish to grab the aircraft title then just loop through the log and locate it. Pretty easy to do.

Loop through each line and look for the "Aircraft Title". Once found explode the string and grab the part you want to use. Then you can use this data for whatever you wish.

Example

$log = explode('*', $xml->pirep->log);

foreach($log as $line) {
if (strpos($line, "Aircraft Title") !== false) {
$temp = $line;
break;
}
}

$temp = explode('-', $title);

$title = $temp[1];

NOTE: Not tested but should work

Thanks a lot. I'll give it a shot to see what will happen.

  • Moderators
Posted

Okay. I implemented the code and echoed $title but nothing showed up. BTW, I had to change " $xml->pirep->log " to " $pirep->log " since I used it in PIREP details in admin view reports. Please tell me where I'm wrong.

Thanks :D

Guest lorathon
Posted

I just relooked at the code.

This may work better.

$log = explode('*', $pirep->log);

foreach($log as $line) {
 if (strpos($line, "Aircraft Title") !== false) {
    $temp = $line;
    break;
 }
}

$temp = explode('-', $temp);

$title = $temp[1];

Guest lorathon
Posted

Yep. Works like a charm, thanks :D

No problem glad I could help.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...