Output METAR Data on your Webpage with PHP

We have a bunch of aviation sites, many that require weather information. We often like to include raw and unformatted TAF and METAR information on a number of locations depending on the type of website.

We have made a small snippet of PHP code available on one of our sister websites that will retrieve METAR information from the noaa.gov website and make it available in a way that can be easily formatted. A list of the available METAR stations is available here.

The code will output text that will look like this:

By using the code below it will retrieve information from the noaa website on every request. For that reason, it’s best to request data for numerous locations at defined intervals and store data in a cache file – thus negating the need to make repeated requests to noaa.gov; and it speeds up the delivery time considerably.

You can download the code from this page. If you have any issue with it please let us know and we’ll only be too happy to help you out.

Related posts:
  1. Easily post an aviation Metar report into your WordPress post or page with shortcode
  2. Easily post an aviation TAF report into your WordPress post or page with shortcode
  3. Metar to Twitter – Free service
  4. This Day in Aviation History on Your Website
  5. FlightAware Tracking Services Now Available in Australia
  6. WordPress Shortcode for FMA Annunciations, FMC Messages & the MCP
  7. Air France Flight 447: Unofficial ACARS

About Marty

Marty is an International airline pilot, commercial helicopter pilot and experienced flight instructor. He is also the Director of a media company based in Sydney, Australia. Connect with Marty on Twitter, Flight Podcast or Google+.


  1. [...] I published some PHP code about 12 months ago that would output a raw aviation metar onto your website. This code is a variation on a theme and will post a Metar directly into a [...]

Please leave a comment or question