机票比较Web应用程序如何获取多家航空公司的机票价格?
如上所述,只是出于病态的好奇心。各个航空公司的网站是否有供这些引擎利用的 API?或者您是否编写程序来导航各个网站并提供输入(出发地、目的地、出发日期、返回日期)并获取输出(价格、时间等)?
编辑:好吧,在我提交问题后才发现这个。尽管如此,还是有兴趣看看它是如何以编程方式完成的。在 Java 中,什么样的库适合这个?
As above, just out of morbid curiosity. Do the websites of individual airlines have APIs for these engines to exploit? Or do you write programs to navigate individual websites and provide inputs (origin, destination, dates of departure, return) and obtain the outputs (price, time etc.)?
Edit: Ok just found this after I submitted question. Still, would be interested in looking at how its done programatically. Say in Java, what kind of libraries would be good for this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
有多种方法可以获取此类信息。
最好的(也是最可靠的)是联系您要与之打交道的航空公司。
许多(如果不是大多数)都会有公共 API 来访问其预订系统,允许用户请求航班报价、座位可用性并进行预订。
当然,通常这需要您和航空公司之间签订合同,告诉您如何使用这些信息,并且对于预订,您可能需要与他们签订另一份合同来处理付款、回扣等。
此类 API 可以是“现代的” “ SOAP 系统,或者更老式的东西,比如 EDI、EJB 调用,或者其他什么,但原则仍然存在:你请求某些东西,他们的服务器会提供请求的信息。
道德上不太正确,更难实施,而且更脆弱,你可以尝试抓取他们的预订引擎。
但它们的屏幕布局当然会定期变化:)
There are several ways to get such information.
The best (and most reliable) would be to contact the airlines you're going to be dealing with.
Many if not most will have public APIs for accessing their reservation system, allowing users to request quotes for flights, seat availability, and make reservations.
Of course usually that will require a contract between you and the airline telling you how you can use the information, and for bookings you're going to probably need another contract with them to handle payments, kickbacks, etc.
Such APIs can be "modern" SOAP systems, or more old fashioned things like EDI, EJB calls, or whatever but the principle remains: you ask for something, their servers give the requested information.
Less ethically correct, harder to implement, and far more fragile you could try screenscraping their reservation engines.
But the screen layout of those of course change regularly :)
与几家“现代”航空公司合作(几乎是矛盾的),聚合器必须轮询票价搜索页面和“屏幕抓取”,当航空公司更新结构页面时,他们必须非常快地更改解析器。
having worked with a couple of 'modern' airlines (almost an oxymoron) the aggregators have to poll the fare search page and 'screen scrape' and when the airline updates the structure page they have to be mighty quick to change there parser.