发表文章

[PHP] 更好的源/API Better Sources / API[CANotAPI]

teamcoltra 2017-10-9 30

看着网站http://www.zuluforpilots.com/Map看起来他们从 NavCanada 通过 AFTN 直接拉 NOTAMs......, 我相信必须有一个 API 直接从 NavCanada 从某个地方提取这些数据。Foreflight 正在做, 其他组织也在这样做。问题是, 这限制了我们到6机场如果我们想要的话, 找到一个可以获得尽可能多的机场或地区的方法是很好的。

我将明星和遵循的代码:)

原文:

Looking at the website http://www.zuluforpilots.com/Map it appears they pull all NOTAMs directly from NavCanada through AFTN... and I believe there has to be an API directly from NavCanada somewhere to pull this data from. Foreflight is doing it, other organizations are doing it. The problem is this limits us to 6 airports it would be great to figure a way to get as many airports or a region if we wanted.

I will star and follow the code :)

相关推荐
最新评论 (13)
rt2 2017-10-9
1

这是一个有趣的讨论。
这和其他航行源的主要区别是, 我设计了一个网站管理员使用它, 并能够发挥与数据最终,层流数据API 数据服务可能做类似的事情, 但他们需要一个关键, 这是这个东西的魅力, 它只是一个 PHP 包含。
最初我做了这个为 CZUL 冷杉和其他 VATCAN 分部 VATSIM 网络, 因此它不是一个问题仅有加拿大机场。
我有一个想法, 也许使一个美国版本的相同的原则, 特别是如果人们要求它。
现在看来, zulugorpilots.com 与加拿大导航部的沟通, 以检索其他机场的 NOTAMs "通过 AFTN"。
也许他们有一个隶属与导航加拿大检索信息从 AFTN 通过他们。

它肯定会很好, 包括所有的机场, 但在一开始, 这只是一个小的挑战, 我给自己在与杉木酋长的讨论。

此出版物包含一些相关信息 此处, 此处, 此处和此处.
AFTN 看起来像是一个封闭的电路。

此处 (AFTN)此处 (AMHS)我们可以阅读它似乎无法从互联网上访问。
我没有做广泛的研究, 因为我没有时间, 但这是我发现。

我不知道是否练习
你觉得怎么样?
rt-2

原文:

This is an interesting discussion.
The main difference between this and other NOTAM sources, is that I designed this for a webmaster to use it in his website and be able to play with the data eventually, Laminar Data and API Data Service might do something similar, but they require a key, and this is the charm of this thing, it's just a PHP include.
Originally I made this for the CZUL FIR and other VATCAN division of the VATSIM Network, so it was not a problem to have only Canadian airports.
I had the idea of maybe making a US version on the same principle, especially if people are asking for it.
Now it would seem that zulugorpilots.com communicate with NAV CANADA to retrieve NOTAMs of other airport "through AFTN".
Maybe they have an affiliation with NAV CANADA to retrieve information from AFTN through them.

It sure would be nice to include all airports, but at first it was just a small challenge I gave myself during a discussion with the FIR chief.

This publication contains somewhat related info here, here, here and here.
AFTN seems like a closed circuit.

here(AFTN) and here(AMHS) we can read that it seems inaccessible from the internet.
I did not do extensive research because I lack of time, but this is what I found.

I don't know if practice,
What do you think?
rt-2

teamcoltra 2017-10-9
2

是的, 我目前正在寻找他们正在使用的方法, 并寻找其他方法。美国有广泛的收集这些数据的方法, 可悲的是, 在加拿大不是这样的。看看有多少人使用 ZuluForPilots 它不是很多人 (他们有像 Facebook 上的20追随者, 而不是很多 Twitter 的追随者), 他们没有一个产品, 所以他们没有收费的任何东西, 使我相信他们使用的来源是免费的。

现在还有仅仅使用他们为自己的服务所做的 API 的可用性和 ping, 这至少会给你 JSON 响应, 而不是 NavCanada 给出的丑陋的响应。

我自己也在调查这一点, 很高兴我们在同一时间开始了我们的项目。如果我发现什么, 我会以你的方式发送或提出请求。

但相信我, 我知道, 有时你所需要的只是一个简单的 php 脚本来提取一些数据, 其余的并不真正重要。:)

原文:

Yeah I am currently searching for the method they are using, and looking for other methods. The US has extensive methods of collecting this data, sadly it's not so in Canada. Looking at how many people use ZuluForPilots it's not many people (they have like 20 followers on Facebook and not many Twitter followers) and they don't have a product so they are not charging for anything which leads me to believe the source they are using is free.

Now there is also the availability of just using the API that they have made for their own service and pinging that, which would at least give you JSON responses instead of the ugly responses given by NavCanada.

I am looking into this myself, it's nice that we started our projects around the same time. If I find anything I will send it your way or make a pull request.

But trust me, I know that sometimes all you need is a simple php script to pull some data and the rest isn't really important. :)

rt2 2017-10-9
3

有趣的, 好点关于 ZuluForPilots。

当你说 api "他们" 的时候, 你在说什么 api?

谢谢

原文:

Interesting, good point about ZuluForPilots.

What API are you talking about when you say the API 'they' have made?

Thank you,

teamcoltra 2017-10-9
4

如果您在 chrome 中观看网络请求, 您可以看到类似http://www.zuluforpilots.com/NotamApi/GetAerodromeNotams?code=CYVR的内容

你可以做这样的事情:

function getNotam($airportCode) {
if(is_array($airportCode)) {
foreach($airportCode as $code) {
$return[$code]json_decode(file_get_contents("http://www.zuluforpilots.com/NotamApi/GetAerodromeNotams?code=$code"));
}
} else {
$return[$airportCode]json_decode(file_get_contents("http://www.zuluforpilots.com/NotamApi/GetAerodromeNotams?code=$airportCode"));
}
return $return;
}
原文:

If you watch the network requests in chrome you can see things like http://www.zuluforpilots.com/NotamApi/GetAerodromeNotams?code=CYVR

You could do something like:

function getNotam($airportCode) {
if(is_array($airportCode)) {
foreach($airportCode as $code) {
$return[$code]json_decode(file_get_contents("http://www.zuluforpilots.com/NotamApi/GetAerodromeNotams?code=$code"));
}
} else {
$return[$airportCode]json_decode(file_get_contents("http://www.zuluforpilots.com/NotamApi/GetAerodromeNotams?code=$airportCode"));
}
return $return;
}
teamcoltra 2017-10-9
5

我只是输入了所有这是为什么它没有格式化, 它可能是不正确的, 我可能应该做其他的, 把数组变成一个数组, 然后在末尾的 foreach。总之, 这只是一个概念的证明。

原文:

I just typed that all out which is why it isn't formatted, it's probably not correct and I probably should do the else as turn the array into an array of one and then foreach at the end. It's all just a proof of concept anyway.

rt2 2017-10-9
6

我刚意识到 zuluforpilots 不在加拿大以外的地方工作, 我认为这个问题的全部目的是让所有的机场不仅是加拿大人?
rt-2

原文:

I just realized that zuluforpilots doesn't work outside of Canada, I though the whole purpose of this issue was to have all airports not only Canadian?
rt-2

teamcoltra 2017-10-9
7

如果你去他们的网站, 缩小, 并进入不同的区域, 你可以看到它的工作在加拿大以外的一些地方, 这是说, 它的主要重点是加拿大, 但不是你的代码吗?为了我的需要, 我只需要加拿大。问题是, 加拿大的来源是糟糕的, 因为你必须格式化它的文本答复, 它也限制你只6机场一次。

原文:

It works a little outside of Canada if you go to their site and zoom out and into different regions you can see... that said it's primarily focused on Canada but isn't your code too? For my needs I just need Canada. The problem is that the Canadian source sucks because you have to format it's text replies and it also limits you to only 6 airports at a time.

rt2 2017-10-9
8

我想添加此 (#1) 的数组版本, 这对您有帮助吗?
你说一次6机场是什么意思?
rt-2

原文:

I wanted to add an array version of this(#1), would that help you?
What do you mean by 6 airports at a time?
rt-2

teamcoltra 2017-10-9
9

哦, 你只是做一个单一的机场, 你的数据源实际上允许多达6机场信息立即提供。可悲的是只有6。

原文:

Oh you are only doing a single airport, your data source actually allows up to 6 airports information to be given at once. Sadly only 6.

rt2 2017-10-9
10

首先, 我有一个巨大的问题, 因为 ' CYUL ' 是硬编码在一些放置, 固定在这里

其次, 如果你查询6机场, 它将会把它写下来, 这样你就可以在一个接一个地调用 CANotAPI_EchoNotamsString 6 次, 这样你就能得到完全相同的结果。

rt-2

原文:

First of all I had huge problem because 'CYUL' was hard coded at some placed, fixed here.

Secondly, what NAV CANADA does if you query 6 airport, it will just write it down one after the other, so you can basically call CANotAPI_EchoNotamsString 6 times in a row and you will have the exact same result.

rt-2

teamcoltra 2017-10-9
11

你修好了!:P 我看到这些, 并打算在早上修复他们为您, 并能够得到我的第一个请求。

原文:

Ugh you fixed that! :P I saw those and was going to fix them in the morning for you and be able to get my first pull request in.

rt2 2017-10-9
12

很抱歉:P
除了 ZuluForPilots 也只能取加拿大 NOTAMs。
和查询多个机场的能力, 我认为这是不重要的, 因为它已经可能与目前的国家海事组织。
在这个问题上你还有什么其他的改进吗?
rt-2

原文:

Well sorry :P
Other than that ZuluForPilots also can only fetch Canadian NOTAMs.
And the ability to query multiple airport I think is not really important since it's already possible with the current state IMO.
Is there any other enhancement you meant in this issue?
rt-2

teamcoltra 2017-10-9
13

我们现在就可以结束这一切如果我对这个问题有任何进一步的想法, 我会重新打开它。

原文:

We can close this for now. If I have any further ideas on the subject, I'll reopen it.

返回
发表文章
teamcoltra
文章数
1
评论数
10
注册排名
8971