Jump to content

Show the METAR of location airport


Karamellwuerfel

Recommended Posts

Hey! This code snippet shows the METAR of the current location airport of the pilot.

You can put it anywhere (I use it on my frontpage_main)

 

<?php $last_location = PIREPData::getLastReports(Auth::$userinfo->pilotid, 1, PIREP_ACCEPTED);
	if(!$last_location) {
		echo '';
	} else { ?>
		<br><br>Your current airport METAR: <i><?php echo file_get_contents("http://wx.ivao.aero/metar.php?id=$last_location->arricao"); ?></i>
	<?php
	} ?>

This code snippet uses the IVAO-METAR. :rolleyes:

Link to comment
Share on other sites

  • Moderators

I would suggest changing the code as the above to make it more portable:

<?php $last_location = PIREPData::getLastReports(Auth::$userinfo->pilotid, 1, PIREP_ACCEPTED);
$icao = $last_location->arricao;
	if(!$last_location) {
		echo '';
	} else { ?>
		<br><br>Your current airport METAR: <i><?php echo file_get_contents("http://wx.ivao.aero/metar.php?id=$icao"); ?></i>
	<?php
	} ?>

This allows you to change ICAO variable to anything you want such as $schedule->depicao or $schedule->arricao or anything else so you can have data from other locations too.

  • Like 1
Link to comment
Share on other sites

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