Jump to content

Recommended Posts

Posted (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 by mattsmith
  • Moderators
Posted

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.

Posted (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 by web541
  • Like 1
Posted
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?

Posted

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) {
...

 

Posted

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)

Posted (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 by web541
Posted
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?

Posted
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.

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...