Please post/share your web page code.

To whom it concerns.


I am a webmaster at a virtual airline site @ [[font=Verdana][color=blue][u][b]Janet Virtual Air[/b][/u][/color][/font]](http://www.janetva.org) and we are very dependent on Departure and Arrival airport weather. As the winds determine what runways we depart and arrive on.

I have a metar webpage that can be viewed @ [font=Verdana][color=blue][u][b]WX METAR[/b][/u][/color][/font]

But what I am looking for is info on writing an index.asp page that some software we use can get the metar data from.

So please share your ASP, PHP, etc… code here.

I also run a game server for FS2002, FS2004, & FSX

If this topic is in the wrong area please move it… Sorry :lol:


Thx, JVA-VP/WM

Hi Dan

I’m not sure what you’re trying to do that your existing WX METAR page couldn’t be modified to do. Don’t you just need to tweak that page rather than try to start our again using someone else’s code?

I need an ASP script that will get the metar data from a metar.txt file:

File content:
2007/07/12 17:50
KBGE 121750Z AUTO 30005KT 10SM SCT060 34/20 A3004 RMK AO2 PWINO

2007/07/12 17:50
KBGE 121750Z AUTO 30005KT 10SM SCT060 34/20 A3004 RMK AO2 PWINO

2007/07/12 17:50
EKGF 121750Z 35006KT 9999 BKN008 13/12 Q1009

2007/07/12 17:45
KTNB 121745Z AUTO 30008KT 10SM CLR 24/09 A3012 RMK AO2

2007/07/12 17:45
KJVL 121745Z 29015G26KT 10SM BKN065 23/09 A2996

2007/07/12 17:45
KTNB 121745Z AUTO 30008KT 10SM CLR 24/09 A3012 RMK AO2

I hae some software that is dependent of getting the data from an asp and I do not know asp…

I see what you mean now. Unfortunately I’m not an ASP user either.

say the asp file name would be metar.asp

and if they type http://xxx.xxx.xxx.xxx/metar.asp?id=KMCI

it would only get the MCI metar


or if they type http://xxx.xxx.xxx.xxx/metar.asp?id=all

it would get all metar data


and if they type http://xxx.xxx.xxx.xxx/metar.asp?id=K

it would get all metar for that region (USA)


The software I am using is called [[color=blue][b][i]servinfo[/i][/b][/color]](http://www.avsim.com/hangar/utils/servinfo/features.htm) and pro controller. (sorry no link) It displays who is flying online, for the different networks. ([[color=blue][b][i]vatsim.net[/i][/b][/color]](http://www.vatsim.net), [[color=blue][b][i]ivao.aero[/i][/b][/color]](http://www.ivao.aero)) and each network has there own metar data, voice data, atis data, etc...

Needless to say I added a button for my virtual airline network. But cannot get all the features to work… Need help with asp code… :slight_smile:

OK, I’ll show my ignorance, what is a virtual airline?

Its a Virtual Airline based on a real world Airline. Used for flying online with FLY, X-Plane, FS2000, FS2002, FS9/FS2004, and FSX (Flightsim gaming software)

My Janet VA history:
Janet EG&G is a civilian company contracted to fly(Air Force 737-200’s) civilian employees that work for the military, to and from MOA’s that are restricted to Civilian airlines for security reasons. . Mainly based out of (McCarran International, Las Vegas.(KLAS) to Area51(Groom Lake) and to/from other Military Operation Area’s(MOA’s)
and they USE the WWW call letters when not inside moa’s, hence my CALL WWW394. :slight_smile:

We just moved to a new domain. [color=blue][b][u]JANET[/u][/b][/color] And we use acars software to log and keep a database of flight hours flown per pilot, as well as a fleet database, (plane hours flown for each aircraft registration in the fleet database).


Thx, JVA-VP/WM

What I would do is first grab the metar file using something like this -

dim strPath, objFso, objTxtStream
strPath = Server.MapPath(“metar.txt”)
Set objFso = CreateObject(“Scripting.fileSystemObject”)
Set objTxtStream = objFso.Opentextfile( strPath )

Then you would need to go through each line putting into an array -

dim myArr
myArr=split(objTxtStream.ReadAll,vbcrlf)

Then you wouldl need to take the requested metar and loop through the array until you find the match

dim metarID
dim counter, metarText
metarID = Request.Querystring(“id”)
For counter = 0 to ubound(myArr)
If left(myArr(counter),4) = metarID Then
metarText = myArr(counter)
Exit For
End If
Next

'and write it to the browser

If metarText <> “” Then
Response.write "The metar says - " & metarText
Else
Response.write “The metar could not be found”
End If

Set objFso = Nothing
Set objTxtStream = Nothing

That’s just me thinking out loud really and you’d probably need to experiement a bit, but hopefully it shows the principle. You would also need to include appropriate error handling etc.

Julian

Julian,

First off I would like to thank you for your help. :slight_smile:

But when it comes to asp I am a big dummy.

So if its not to much trouble I need more info/input…

what do I do with the code you have already given me?

The metar path is here: METAR
FSD is game server software for Flightsim online gaming community as I mentioned in an earlier post.
It can be found here @ www.MCDU.com
It pulls the metar data from NOAA and imports it into the FSD game server so pilots have real world weather while flying on line.

And we use servinfo to get the FSD game server data to see who is playing online. But servinfo requires a live data page to retrieve the weather data. (metar.asp)

I guess in a round about way I am asking you to write all the code for me :slight_smile:

Are you interested in being my JVA-AWM? (Asst. Web Master) I need somebody that knows php, asp, etc… better than me.

I can’t write code, but I can rewrite code… :slight_smile: I find something on the internet then edit it to suite my needs, as in the metar page and the FSAcars pages on my JVA site.

I don’t have time to write all the code for you but what I’ve done should get you started. Just place this in your html page and give it a .asp extension. Place the metar.txt file in the same directory and see what happens :slight_smile:


<%
dim strPath, objFso, objTxtStream  
strPath = Server.MapPath("metar.txt") 
Set objFso = CreateObject("Scripting.fileSystemObject") 
Set objTxtStream = objFso.Opentextfile( strPath ) 
dim myArr 
myArr=split(objTxtStream.ReadAll,vbcrlf)
dim metarID
dim counter, metarText
metarID = Request.Querystring("id")
For counter = 0 to ubound(myArr)
  If left(myArr(counter),4) = metarID Then
  metarText = myArr(counter)
  Exit For
  End If
Next
If metarText <> "" Then
Response.write "The metar says - " & metarText
Else
Response.write "The metar could not be found"
End If

Set objFso = Nothing
Set objTxtStream = Nothing
%>

I haven’t tested any of this so you’re bound to get errors but it should be enough for you to get started. Note that the metar.txt needs to be a file on the server, this won’t work for a remote file.

Julian

:smiley: THX! :smiley: