Jump to content

Recommended Posts

Posted

Hi All,

Just thought this would come in handy basically the user enters the ICAO then the metar will display in an iframe,

Preview:

When no ICAO entered:

a.jpg

When an ICAO code has been entered (EGKK)

b.jpg

<form action="weather" method="post">
Get METAR For:
 <input type="text" name="icao" />
 <input type="submit" />
</form>

Latest METAR:
<iframe src="http://www.vatsim.net/data/metar.php?id=<?php echo $_POST["icao"]; ?>" class="metar" width="200" height="75" frameborder="0" scrolling="no">></iframe>

Kind Regards,

Jon

  • 1 year later...
Posted

hey guys,

happy newyear !!

we were trying this code but we get this as reply :

Not Found

The requested URL /weer/weather was not found on this server.

Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.

Any ideas?

Posted

I don't like the iframes. That's why I use this:

<?php
$location = "EGLL";

get_metar($location);

function get_metar($location) {
$fileName = "http://weather.noaa.gov/pub/data/observations/metar/stations/$location.TXT";
$metar = '';
$fileData = @file($fileName) or die('METAR not available');
if ($fileData != false) {
	list($i, $date) = each($fileData); 

	$utc = strtotime(trim($date));
	$time = date("D, F jS Y g:i A",$utc);

	while (list($i, $line) = each($fileData)) {
		$metar .= ' ' . trim($line);
		}
	$metar = trim(str_replace('  ', ' ', $metar));
	}
echo "METAR FOR $location (Issued: $time UTC):<br>$metar";
}
?>

You can change the location to <?php echo $schedule->depicao;?> or arricao in the schedule briefing or details. It's much better than the default METARs in phpVMS because they don't have to load.

Posted

I don't like the iframes. That's why I use this:

<?php
$location = "EGLL";

get_metar($location);

function get_metar($location) {
$fileName = "http://weather.noaa.gov/pub/data/observations/metar/stations/$location.TXT";
$metar = '';
$fileData = @file($fileName) or die('METAR not available');
if ($fileData != false) {
	list($i, $date) = each($fileData); 

	$utc = strtotime(trim($date));
	$time = date("D, F jS Y g:i A",$utc);

	while (list($i, $line) = each($fileData)) {
		$metar .= ' ' . trim($line);
		}
	$metar = trim(str_replace('  ', ' ', $metar));
	}
echo "METAR FOR $location (Issued: $time UTC):<br>$metar";
}
?>

You can change the location to <?php echo $schedule->depicao;?> or arricao in the schedule briefing or details. It's much better than the default METARs in phpVMS because they don't have to load.

We need to have a form attached to enter the ICAO of choice. When I read this correct it only shows a fixed ICAO or the dep/arricao in a scheduled flight.

post-2881-085226500 1325763772_thumb.jpg

Posted

We need to have a form attached to enter the ICAO of choice. When I read this correct it only shows a fixed ICAO or the dep/arricao in a scheduled flight.

Yes but this is for schedule briefings etcso that the pilot doesn't need to enter anything.

  • 2 years later...
Posted

Hi,

In what tpl did you change it?

I don't like the iframes. That's why I use this:

<?php
$location = "EGLL";

get_metar($location);

function get_metar($location) {
$fileName = "http://weather.noaa.gov/pub/data/observations/metar/stations/$location.TXT";
   $metar = '';
   $fileData = @file($fileName) or die('METAR not available');
   if ($fileData != false) {
       list($i, $date) = each($fileData); 

       $utc = strtotime(trim($date));
       $time = date("D, F jS Y g:i A",$utc);

       while (list($i, $line) = each($fileData)) {
           $metar .= ' ' . trim($line);
           }
       $metar = trim(str_replace('  ', ' ', $metar));
       }
   echo "METAR FOR $location (Issued: $time UTC):<br>$metar";
   }
?>

You can change the location to <?php echo $schedule->depicao;?> or arricao in the schedule briefing or details. It's much better than the default METARs in phpVMS because they don't have to load.

Posted

I use this script in my briefings, so schedule_briefing.tpl.

If you want it in that, use:

<?php
function get_metar($location){
$fileName = "http://weather.noaa.gov/pub/data/observations/metar/stations/$location.TXT";
       $metar = '';
       $fileData = @file($fileName) or die('METAR not available');
       if ($fileData != false) {
               list($i, $date) = each($fileData); 

               $utc = strtotime(trim($date));
               $time = date("D, F jS Y g:i A",$utc);

               while (list($i, $line) = each($fileData)) {
                       $metar .= ' ' . trim($line);
                       }
               $metar = trim(str_replace('  ', ' ', $metar));
               }
       echo "METAR FOR $location (Issued: $time UTC):<br>$metar";
}

echo get_metar($schedule->depicao);
echo "</br>";
echo get_metar($schedule->arricao);
?>

Posted

Thank you very much itrobb, for help, so also is possible to put this information over schedule_details.tlp?

I will visit now your site to see.

bruno

itrobb

I use this script in my briefings, so schedule_briefing.tpl.

If you want it in that, use:

<?php
function get_metar($location){
$fileName = "http://weather.noaa.gov/pub/data/observations/metar/stations/$location.TXT";
$metar = '';
$fileData = @file($fileName) or die('METAR not available');
if ($fileData != false) {
list($i, $date) = each($fileData);

$utc = strtotime(trim($date));
$time = date("D, F jS Y g:i A",$utc);

while (list($i, $line) = each($fileData)) {
$metar .= ' ' . trim($line);
}
$metar = trim(str_replace(' ', ' ', $metar));
}
echo "METAR FOR $location (Issued: $time UTC):<br>$metar";
}

echo get_metar($schedule->depicao);
echo "</br>";
echo get_metar($schedule->arricao);
?>

Posted

I'd be grateful if you could share with me your code for the metar pullout.

Sorry m8 i cant that was made just for us and wasent free :( i can talk with my friend and ask him. Pm me with contact details.

  • 1 year later...
  • 1 year later...

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