Moderators Parkho Posted July 23, 2013 Moderators Report Share Posted July 23, 2013 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 Quote Link to comment Share on other sites More sharing options...
Members Vangelis Posted July 23, 2013 Members Report Share Posted July 23, 2013 I personaly dont use xml i have done it with $_post Quote Link to comment Share on other sites More sharing options...
Moderators Parkho Posted July 23, 2013 Author Moderators Report Share Posted July 23, 2013 Can you be more specific please. Thanks Quote Link to comment Share on other sites More sharing options...
Members Vangelis Posted July 23, 2013 Members Report Share Posted July 23, 2013 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 Quote Link to comment Share on other sites More sharing options...
Moderators Parkho Posted July 23, 2013 Author Moderators Report Share Posted July 23, 2013 Thanks. What i meant was for kACARS client and its aircraft variable. Quote Link to comment Share on other sites More sharing options...
Members Vangelis Posted July 23, 2013 Members Report Share Posted July 23, 2013 wana share what you want to do ? Quote Link to comment Share on other sites More sharing options...
Moderators Parkho Posted July 23, 2013 Author Moderators Report Share Posted July 23, 2013 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. Quote Link to comment Share on other sites More sharing options...
Members Vangelis Posted July 23, 2013 Members Report Share Posted July 23, 2013 isnt it happening already ? i dont remember i am now at work i will have a look tomorrow Quote Link to comment Share on other sites More sharing options...
Guest lorathon Posted July 23, 2013 Report Share Posted July 23, 2013 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); Quote Link to comment Share on other sites More sharing options...
Moderators Parkho Posted July 24, 2013 Author Moderators Report Share Posted July 24, 2013 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 Quote Link to comment Share on other sites More sharing options...
Members Vangelis Posted July 24, 2013 Members Report Share Posted July 24, 2013 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 Quote Link to comment Share on other sites More sharing options...
Guest lorathon Posted July 24, 2013 Report Share Posted July 24, 2013 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 Quote Link to comment Share on other sites More sharing options...
Moderators Parkho Posted July 24, 2013 Author Moderators Report Share Posted July 24, 2013 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. Quote Link to comment Share on other sites More sharing options...
Moderators Parkho Posted July 24, 2013 Author Moderators Report Share Posted July 24, 2013 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 Quote Link to comment Share on other sites More sharing options...
Guest lorathon Posted July 24, 2013 Report Share Posted July 24, 2013 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]; Quote Link to comment Share on other sites More sharing options...
Moderators Parkho Posted July 25, 2013 Author Moderators Report Share Posted July 25, 2013 Yep. Works like a charm, thanks Quote Link to comment Share on other sites More sharing options...
Guest lorathon Posted July 25, 2013 Report Share Posted July 25, 2013 Yep. Works like a charm, thanks No problem glad I could help. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.