mattsmith Posted January 2, 2017 Report Share Posted January 2, 2017 (edited) If i was to make an alliance airline with each airline having a different site how would i pull the info from each site? I.e Live Map, Pireps, Total schedules etc Edited January 7, 2017 by mattsmith Quote Link to comment Share on other sites More sharing options...
Moderators Parkho Posted January 2, 2017 Moderators Report Share Posted January 2, 2017 Assuming they're both on the same host, you'll need to create a subdomain for your alliance airline and create a separate DB for it. Then you'll be able to read data for your alliance airline. Quote Link to comment Share on other sites More sharing options...
mattsmith Posted January 2, 2017 Author Report Share Posted January 2, 2017 What if they were on different hosts i.e If someone asks to join the alliance, like Aeolus do with there site. Quote Link to comment Share on other sites More sharing options...
Members Vangelis Posted January 2, 2017 Members Report Share Posted January 2, 2017 You can get a json output for each airline with the following addres www.website.com/action.php/acars/data and then display it in your aliance website 2 Quote Link to comment Share on other sites More sharing options...
mattsmith Posted January 2, 2017 Author Report Share Posted January 2, 2017 Do you know how i would show this info on the ACARS map Quote Link to comment Share on other sites More sharing options...
web541 Posted January 2, 2017 Report Share Posted January 2, 2017 (edited) Well first you'd have to ask the airline's if they're ok with it, then you can proceed. Second, the ACARS function that outputs the data is found here https://github.com/DavidJClark/phpvms_5.5.x/blob/master/core/modules/ACARS/ACARS.php#L52 And luckily that returns an array of data which is easy to merge. I haven't tested it and have probably forgotten something, but you can build on something like this $allflights = array(); $myairline = ACARSData::GetACARSData(); // If you have multiple airlines, you could also loop this through $another_airline = json_decode(file_get_contents('va_url_here'), true); // specify true for an array conversion $allflights = array_merge($myairline, $another_airline); foreach($allflights as $flight) { ... You'd also have to verify what data is actually being returned to make it all fit together. Edited January 2, 2017 by web541 1 Quote Link to comment Share on other sites More sharing options...
mattsmith Posted January 6, 2017 Author Report Share Posted January 6, 2017 On 02/01/2017 at 10:24 PM, web541 said: Well first you'd have to ask the airline's if they're ok with it, then you can proceed. Second, the ACARS function that outputs the data is found here https://github.com/DavidJClark/phpvms_5.5.x/blob/master/core/modules/ACARS/ACARS.php#L52 And luckily that returns an array of data which is easy to merge. I haven't tested it and have probably forgotten something, but you can build on something like this $allflights = array(); $myairline = ACARSData::GetACARSData(); // If you have multiple airlines, you could also loop this through $another_airline = json_decode(file_get_contents('va_url_here'), true); // specify true for an array conversion $allflights = array_merge($myairline, $another_airline); foreach($allflights as $flight) { ... You'd also have to verify what data is actually being returned to make it all fit together. Can't get it to work, any idea? Quote Link to comment Share on other sites More sharing options...
Members Vangelis Posted January 6, 2017 Members Report Share Posted January 6, 2017 any code ? Quote Link to comment Share on other sites More sharing options...
mattsmith Posted January 6, 2017 Author Report Share Posted January 6, 2017 Im just learning coding so i haven,t got any yet I've just been using this and changing things in core/modules/ACARS $allflights = array(); $myairline = ACARSData::GetACARSData(); // If you have multiple airlines, you could also loop this through $another_airline = json_decode(file_get_contents('va_url_here'), true); // specify true for an array conversion $allflights = array_merge($myairline, $another_airline); foreach($allflights as $flight) { ... Quote Link to comment Share on other sites More sharing options...
web541 Posted January 6, 2017 Report Share Posted January 6, 2017 Ah yes, that was just a rough sketch, you'd need to adapt it a bit. Good news is, once the data is in one array, it should be able to just join up and display it in the template (hopefully, unless phpVMS is routing the ACARS through another place as well). And how many virtual airlines do you need to have on the ACARS map? (1 or more) Quote Link to comment Share on other sites More sharing options...
mattsmith Posted January 6, 2017 Author Report Share Posted January 6, 2017 Ideally a few airlines Quote Link to comment Share on other sites More sharing options...
web541 Posted January 6, 2017 Report Share Posted January 6, 2017 (edited) Ok, I'll re-instate that you must have permission from them to do this first, but then proceed. I've just tested this and it works Replace this $flights = ACARSData::GetACARSData(); with this (in core/ACARS/ACARS.php) ///////////////////////////////////////////////////////////// // UPDATED ACARS DATA ///////////////////////////////////////////////////////////// $myflights = ACARSData::GetACARSData(); if(!$myflights) $myflights = array(); $other_airlines = array( json_decode(file_get_contents('http://yourvaurl.com/action.php/acars/data', true)), ); // This will get all the other airlines data $flights = array(); foreach($other_airlines as $airline) { foreach($airline as $a) { $flights[] = $a; } } $flights = array_merge($flights, $myflights); ///////////////////////////////////////////////////////////// // END UPDATED ACARS DATA ///////////////////////////////////////////////////////////// And replace http://yourvaurl.com/ with the va url which you are trying to retrieve, and for more airlines, just copy that line (json_decode(...) and again change the url and it should work (although I've only tested it with one airline, but it should work as expected). Edited January 6, 2017 by web541 Quote Link to comment Share on other sites More sharing options...
mattsmith Posted January 6, 2017 Author Report Share Posted January 6, 2017 I wouldn't think of using anything without permission. Quote Link to comment Share on other sites More sharing options...
web541 Posted January 6, 2017 Report Share Posted January 6, 2017 2 minutes ago, mattsmith said: I wouldn't think of using anything without permission. never said you did and not directing it at you specifically, but to anyone who may come across this thread in the future. But besides that, did the code work? Quote Link to comment Share on other sites More sharing options...
mattsmith Posted January 6, 2017 Author Report Share Posted January 6, 2017 22 minutes ago, web541 said: never said you did and not directing it at you specifically, but to anyone who may come across this thread in the future. But besides that, did the code work? Yes it works thanks very much. 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.