Karamellwuerfel Posted January 10, 2017 Report Posted January 10, 2017 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. Quote
Moderators servetas Posted January 12, 2017 Moderators Report Posted January 12, 2017 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. 1 Quote
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.