Jump to content
Tylor Eddy

VATSIM Metar

Recommended Posts

G'day Guys,

I've been fidding around with METAR information, and have managed to get a working script of the VATSIM metar information. Best part about it is that there is NO iframes!

Here is a quick shot to show you what it looks like

metar_zpsc180e4d6.jpg

For Departure Airport:

<?php
$metar = $_POST['metar'];
$url = 'http://metar.vatsim.net/'.$schedule->depicao.'';
$page = file_get_contents($url);
echo $page;
?>

For Arrival Airport:

<?php
$metar = $_POST['metar'];
$url = 'http://metar.vatsim.net/'.$schedule->arricao.'';
$page = file_get_contents($url);
echo $page;
?>

Hopefully you guys find this valuable :)

  • Like 4

Share this post


Link to post
Share on other sites

You can add the code where ever you want it to be displayed.

For anyone using this code: be aware, Vatsim is rather strict when it comes to downloading data from their servers, and with this code, every metar will be downloaded every time someone accesses the page. If you have quite some traffic to your site, they'll easily block your server's access to download from Vatsim, so you might want to consider downloading and save the data on your server, and then have a script check if your local file is older than x minutes, and if it is, redownload. It's not too difficult to set up, and all you need can be found by a simple search (I don't have access to my FTP at the moment so I can't post my code)

Have a read in the Vatsim forums as well:

http://forums.vatsim.net/viewtopic.php?f=68&t=65859

Anders

Share this post


Link to post
Share on other sites

For the non-members:

If you utilise the VATSIM METAR system on your website, please have a read of my post regarding the options available to you:

http://forums.vatsim...hp?f=68&t=65858

Specifically please consider how many concurrent requests you are making and how often.

The IPs below have been flagged as having make grossly excessive numbers of requests to the METAR system. By this I'm talking in the tens of thousands of requests per day. Considering you can download the entire METAR file in a single request and that METARs don't update more than about once every 30 mins, you can have all the METARs available to you with 48 requests per day.

The record was hit last night, I won't single out the IP, but it was 99,904 individual requests in 24 hours! icon_biggrin.gif

If your ARE in the list

If your IP is below you need to re-think how you are calling the METARs and use the ability to obtain more than one at once, if you aren't already. See my post for more details. From this time next week, I will start blocking IPs on this list that continue with "excessive" usage. Feel free to get in touch with me if you recognise your IP and would like me to hold off banning it while you make the appropriate changes.

If you AREN'T in the list

Please have a look anyway to make sure you are following the guidance in my post. Those I've listed below are requesting in the tens of thousands and therefore I've flagged as "grossly excessive". There are still many many sites making an excessive number of requests that I haven't listed below.

Above all, please keep in mind that it's not just you using the system and that we want to keep it available to everyone. Thanks for your cooperation icon_smile.gif

------

101.165.123.94

109.152.30.23

119.181.196.253

121.214.207.15

128.68.103.32

134.117.250.14

151.224.165.177

173.168.164.239

179.197.148.51

179.236.68.51

186.244.65.72

186.59.153.154

186.59.219.242

186.66.71.95

186.90.26.249

190.213.227.80

193.80.83.17

193.83.62.198

2.219.31.11

202.156.9.10

212.83.134.11

212.83.134.8

217.122.54.179

24.177.217.208

24.41.167.220

31.209.47.229

41.17.242.78

46.117.61.240

46.39.36.138

5.65.94.212

58.6.156.2

62.129.239.116

67.3.216.160

69.80.37.100

71.188.84.71

71.92.161.212

73.178.115.165

76.11.67.0

76.69.139.128

77.57.18.47

78.14.9.127

81.251.202.245

81.39.251.89

82.55.215.63

83.162.242.118

84.113.101.240

84.115.244.4

84.146.230.75

84.146.234.100

86.134.154.127

86.146.43.65

86.169.95.252

86.201.88.226

88.181.163.7

88.65.181.169

89.144.217.195

89.151.134.92

89.178.219.172

89.216.236.150

89.227.116.51

89.227.222.125

90.217.68.196

90.34.91.86

92.104.43.160

92.133.69.109

92.237.208.32

92.74.241.113

92.74.243.178

93.93.112.27

94.159.246.194

94.185.176.218

94.216.166.63

94.254.119.209

94.38.138.98

94.38.139.1

95.26.131.229

Share this post


Link to post
Share on other sites

For Departure Airport:

<?php
$metar = $_POST['metar'];
$url = 'http://weather.noaa.gov/pub/data/observations/metar/stations/'.$schedule->depicao.'.txt'';
$page = file_get_contents($url);
echo $page;
?>

For Arrival Airport:

<?php
$metar = $_POST['metar'];
$url = 'http://weather.noaa.gov/pub/data/observations/metar/stations'.$schedule->arricao.'.txt'';
$page = file_get_contents($url);
echo $page;
?>

Share this post


Link to post
Share on other sites

there is no need to do that you can save the txt file on your server and grab it from there i might be able to give you a script 2morrow as i am still at work

Share this post


Link to post
Share on other sites
On 17/09/2014 at 9:54 PM, Vangelis said:

there is no need to do that you can save the txt file on your server and grab it from there i might be able to give you a script 2morrow as i am still at work

Hey Vangelis,

I know this post is old but I'm wondering whether you wrote a script for this?

Thanks,

Pete

Share this post


Link to post
Share on other sites
On 5/1/2018 at 4:13 PM, shakamonkey88 said:

No problem. We’re now using checkwx and their API. Will try out alternative PHP cache using apc_store and apc_fetch. 

CheckWX is real easy to use. I took a super old PHP parser and updating it to run with the latest PHP:

https://github.com/nabeelio/phpvms/blob/master/app/Support/Metar.php

This is the original:

https://github.com/hsdn/metar-taf

Share this post


Link to post
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...