某某茶叶有限公司欢迎您!
金沙棋牌在线 > 操作系统 > 航班实时起降查询API代码实现

航班实时起降查询API代码实现

时间:2020-01-17 14:29

    航班实时起降查询代码实现功能:
    当日航班,含国际 orgCity dstCity 通过始发城市查询航班 | flightNo 通过航班号查询航班。
    接口名称:航班实时起降查询
    接口平台:聚合数据
    接口地址:
    支持格式:json/xml
    请求方式:HTTP GET/POST
    请求示例:
    航班实时起降查询调用代码JSON返回示例:
        {  
            "resultcode": "200",  
            "reason": "Success",  
            "result": [  
                {  
                    "FlightNo": "CZ9378",  
                    "Rate": "92.00",  
                    "DepCity": "北京首都",  
                    "DepCode": "PEK",  
                    "ArrCity": "武汉天河",  
                    "ArrCode": "WUH",  
                    "DepTerminal": "T2",  
                    "ArrTerminal": "T2",  
                    "DepScheduled": "2014-12-19T08:05:00",  
                    "ArrScheduled": "2014-12-19T10:15:00",  
                    "DepEstimated": "2014-12-19T08:23:00",  
                    "ArrEstimated": "2014-12-19T09:40:00",  
                    "DepActual": "2014-12-19T08:23:00",  
                    "ArrActual": "2014-12-19T10:09:00",  
                    "FlightState": "到达",  
                    "arrRate": "93"  
                },  
                {  
                    "FlightNo": "MU2460",  
                    "Rate": "92.00",  
                    "DepCity": "北京首都",  
                    "DepCode": "PEK",  
                    "ArrCity": "武汉天河",  
                    "ArrCode": "WUH",  
                    "DepTerminal": "T2",  
                    "ArrTerminal": "T2",  
                    "DepScheduled": "2014-12-19T08:05:00",  
                    "ArrScheduled": "2014-12-19T10:15:00",  
                    "DepEstimated": "2014-12-19T08:05:00",  
                    "ArrEstimated": "2014-12-19T10:15:00",  
                    "DepActual": "2014-12-19T08:23:00",  
                    "ArrActual": "2014-12-19T10:09:00",  
                    "FlightState": "到达",  
                    "arrRate": "90.67"  
                },  
                {  
                    "FlightNo": "MU3185",  
                    "Rate": "92.00",  
                    "DepCity": "北京首都",  
                    "DepCode": "PEK",  
                    "ArrCity": "武汉天河",  
                    "ArrCode": "WUH",  
                    "DepTerminal": "T2",  
                    "ArrTerminal": "T2",  
                    "DepScheduled": "2014-12-19T08:35:00",  
                    "ArrScheduled": "2014-12-19T10:45:00",  
                    "DepEstimated": "2014-12-19T08:51:00",  
                    "ArrEstimated": "2014-12-19T10:48:00",  
                    "DepActual": "2014-12-19T08:51:00",  
                    "ArrActual": "2014-12-19T10:38:00",  
                    "FlightState": "到达",  
                    "arrRate": "89.33"  
                },  
                {  
                    "FlightNo": "MF4777",  
                    "Rate": "92.00",  
                    "DepCity": "北京首都",  
                    "DepCode": "PEK",  
                    "ArrCity": "武汉天河",  
                    "ArrCode": "WUH",  
                    "DepTerminal": "T2",  
                    "ArrTerminal": "T2",  
                    "DepScheduled": "2014-12-19T08:35:00",  
                    "ArrScheduled": "2014-12-19T10:45:00",  
                    "DepEstimated": "2014-12-19T08:51:00",  
                    "ArrEstimated": "2014-12-19T10:48:00",  
                    "DepActual": "2014-12-19T08:51:00",  
                    "ArrActual": "2014-12-19T10:38:00",  
                    "FlightState": "到达",  
                    "arrRate": "89.67"  
                },  
                {  
                    "FlightNo": "CZ6605",  
                    "Rate": "95.00",  
                    "DepCity": "北京首都",  
                    "DepCode": "PEK",  
                    "ArrCity": "武汉天河",  
                    "ArrCode": "WUH",  
                    "DepTerminal": "T2",  
                    "ArrTerminal": "T2",  
                    "DepScheduled": "2014-12-19T08:35:00",  
                    "ArrScheduled": "2014-12-19T10:45:00",  
                    "DepEstimated": "2014-12-19T08:30:00",  
                    "ArrEstimated": "2014-12-19T10:38:00",  
                    "DepActual": "2014-12-19T08:51:00",  
                    "ArrActual": "2014-12-19T10:38:00",  
                    "FlightState": "到达",  
                    "arrRate": "90"  
                },  
                {  
                    "FlightNo": "CZ3118",  
                    "Rate": "92.00",  
                    "DepCity": "北京首都",  
                    "DepCode": "PEK",  
                    "ArrCity": "武汉天河",  
                    "ArrCode": "WUH",  
                    "DepTerminal": "T2",  
                    "ArrTerminal": "T2",  
                    "DepScheduled": "2014-12-19T10:55:00",  
                    "ArrScheduled": "2014-12-19T13:20:00",  
                    "DepEstimated": "0001-01-01T00:00:00",  
                    "ArrEstimated": "0001-01-01T00:00:00",  
                    "DepActual": "0001-01-01T00:00:00",  
                    "ArrActual": "0001-01-01T00:00:00",  
                    "FlightState": "延误",  
                    "arrRate": "95.33"  
                },  
                {  
                    "FlightNo": "MU3019",  
                    "Rate": "92.00",  
                    "DepCity": "北京首都",  
                    "DepCode": "PEK",  
                    "ArrCity": "武汉天河",  
                    "ArrCode": "WUH",  
                    "DepTerminal": "T2",  
                    "ArrTerminal": "T2",  
                    "DepScheduled": "2014-12-19T10:55:00",  
                    "ArrScheduled": "2014-12-19T13:20:00",  
                    "DepEstimated": "0001-01-01T00:00:00",  
                    "ArrEstimated": "0001-01-01T00:00:00",  
                    "DepActual": "0001-01-01T00:00:00",  
                    "ArrActual": "0001-01-01T00:00:00",  
                    "FlightState": "延误",  
                    "arrRate": "95"  
                },  
                {  
                    "FlightNo": "MF1020",  
                    "Rate": "92.00",  
                    "DepCity": "北京首都",  
                    "DepCode": "PEK",  
                    "ArrCity": "武汉天河",  
                    "ArrCode": "WUH",  
                    "DepTerminal": "T2",  
                    "ArrTerminal": "T2",  
                    "DepScheduled": "2014-12-19T10:55:00",  
                    "ArrScheduled": "2014-12-19T13:20:00",  
                    "DepEstimated": "0001-01-01T00:00:00",  
                    "ArrEstimated": "0001-01-01T00:00:00",  
                    "DepActual": "0001-01-01T00:00:00",  
                    "ArrActual": "0001-01-01T00:00:00",  
                    "FlightState": "延误",  
                    "arrRate": "95.33"  
                },  
                {  
                    "FlightNo": "ZH1475",  
                    "Rate": "90.00",  
                    "DepCity": "北京首都",  
                    "DepCode": "PEK",  
                    "ArrCity": "武汉天河",  
                    "ArrCode": "WUH",  
                    "DepTerminal": "T3",  
                    "ArrTerminal": "T2",  
                    "DepScheduled": "2014-12-19T11:20:00",  
                    "ArrScheduled": "2014-12-19T13:30:00",  
                    "DepEstimated": "2014-12-19T11:20:00",  
                    "ArrEstimated": "2014-12-19T13:30:00",  
                    "DepActual": "0001-01-01T00:00:00",  
                    "ArrActual": "0001-01-01T00:00:00",  
                    "FlightState": "计划",  
                    "arrRate": "92.33"  
                },  
                {  
                    "FlightNo": "SC1475",  
                    "Rate": "90.00",  
                    "DepCity": "北京首都",  
                    "DepCode": "PEK",  
                    "ArrCity": "武汉天河",  
                    "ArrCode": "WUH",  
                    "DepTerminal": "T3",  
                    "ArrTerminal": "T2",  
                    "DepScheduled": "2014-12-19T11:20:00",  
                    "ArrScheduled": "2014-12-19T13:30:00",  
                    "DepEstimated": "2014-12-19T11:20:00",  
                    "ArrEstimated": "2014-12-19T13:30:00",  
                    "DepActual": "0001-01-01T00:00:00",  
                    "ArrActual": "0001-01-01T00:00:00",  
                    "FlightState": "计划",  
                    "arrRate": "92.33"  
                },  
                {  
                    "FlightNo": "CA1475",  
                    "Rate": "93.33",  
                    "DepCity": "北京首都",  
                    "DepCode": "PEK",  
                    "ArrCity": "武汉天河",  
                    "ArrCode": "WUH",  
                    "DepTerminal": "T3",  
                    "ArrTerminal": "T2",  
                    "DepScheduled": "2014-12-19T11:20:00",  
                    "ArrScheduled": "2014-12-19T13:30:00",  
                    "DepEstimated": "2014-12-19T11:20:00",  
                    "ArrEstimated": "2014-12-19T13:30:00",  
                    "DepActual": "0001-01-01T00:00:00",  
                    "ArrActual": "0001-01-01T00:00:00",  
                    "FlightState": "计划",  
                    "arrRate": "92.33"  
                },  
                {  
                    "FlightNo": "CZ9382",  
                    "Rate": "93.33",  
                    "DepCity": "北京首都",  
                    "DepCode": "PEK",  
                    "ArrCity": "武汉天河",  
                    "ArrCode": "WUH",  
                    "DepTerminal": "T2",  
                    "ArrTerminal": "T2",  
                    "DepScheduled": "2014-12-19T11:40:00",  
                    "ArrScheduled": "2014-12-19T13:55:00",  
                    "DepEstimated": "2014-12-19T11:40:00",  
                    "ArrEstimated": "2014-12-19T13:55:00",  
                    "DepActual": "0001-01-01T00:00:00",  
                    "ArrActual": "0001-01-01T00:00:00",  
                    "FlightState": "计划",  
                    "arrRate": "92"  
                },  
                {  
                    "FlightNo": "MU2452",  
                    "Rate": "93.33",  
                    "DepCity": "北京首都",  
                    "DepCode": "PEK",  
                    "ArrCity": "武汉天河",  
                    "ArrCode": "WUH",  
                    "DepTerminal": "T2",  
                    "ArrTerminal": "T2",  
                    "DepScheduled": "2014-12-19T11:40:00",  
                    "ArrScheduled": "2014-12-19T13:55:00",  
                    "DepEstimated": "2014-12-19T11:40:00",  
                    "ArrEstimated": "2014-12-19T13:55:00",  
                    "DepActual": "0001-01-01T00:00:00",  
                    "ArrActual": "0001-01-01T00:00:00",  
                    "FlightState": "计划",  
                    "arrRate": "93.67"  
                },  
                {  
                    "FlightNo": "HU7187",  
                    "Rate": "96.67",  
                    "DepCity": "北京首都",  
                    "DepCode": "PEK",  
                    "ArrCity": "武汉天河",  
                    "ArrCode": "WUH",  
                    "DepTerminal": "T1",  
                    "ArrTerminal": "T2",  
                    "DepScheduled": "2014-12-19T12:20:00",  
                    "ArrScheduled": "2014-12-19T14:40:00",  
                    "DepEstimated": "2014-12-19T12:20:00",  
                    "ArrEstimated": "2014-12-19T14:40:00",  
                    "DepActual": "0001-01-01T00:00:00",  
                    "ArrActual": "0001-01-01T00:00:00",  
                    "FlightState": "计划",  
                    "arrRate": "95.67"  
                },  
                {  
                    "FlightNo": "ZH1873",  
                    "Rate": "93.33",  
                    "DepCity": "北京首都",  
                    "DepCode": "PEK",  
                    "ArrCity": "武汉天河",  
                    "ArrCode": "WUH",  
                    "DepTerminal": "T3",  
                    "ArrTerminal": "T2",  
                    "DepScheduled": "2014-12-19T13:15:00",  
                    "ArrScheduled": "2014-12-19T15:35:00",  
                    "DepEstimated": "2014-12-19T13:15:00",  
                    "ArrEstimated": "2014-12-19T15:35:00",  
                    "DepActual": "0001-01-01T00:00:00",  
                    "ArrActual": "0001-01-01T00:00:00",  
                    "FlightState": "计划",  
                    "arrRate": "93.33"  
                },  
                {  
                    "FlightNo": "SC1873",  
                    "Rate": "93.33",  
                    "DepCity": "北京首都",  
                    "DepCode": "PEK",  
                    "ArrCity": "武汉天河",  
                    "ArrCode": "WUH",  
                    "DepTerminal": "T3",  
                    "ArrTerminal": "T2",  
                    "DepScheduled": "2014-12-19T13:15:00",  
                    "ArrScheduled": "2014-12-19T15:35:00",  
                    "DepEstimated": "2014-12-19T13:15:00",  
                    "ArrEstimated": "2014-12-19T15:35:00",  
                    "DepActual": "0001-01-01T00:00:00",  
                    "ArrActual": "0001-01-01T00:00:00",  
                    "FlightState": "计划",  
                    "arrRate": "93.33"  
                },  
                {  
                    "FlightNo": "CA1873",  
                    "Rate": "93.33",  
                    "DepCity": "北京首都",  
                    "DepCode": "PEK",  
                    "ArrCity": "武汉天河",  
                    "ArrCode": "WUH",  
                    "DepTerminal": "T3",  
                    "ArrTerminal": "T2",  
                    "DepScheduled": "2014-12-19T13:15:00",  
                    "ArrScheduled": "2014-12-19T15:35:00",  
                    "DepEstimated": "2014-12-19T13:15:00",  
                    "ArrEstimated": "2014-12-19T15:35:00",  
                    "DepActual": "0001-01-01T00:00:00",  
                    "ArrActual": "0001-01-01T00:00:00",  
                    "FlightState": "计划",  
                    "arrRate": "93.33"  
                },  
                {  
                    "FlightNo": "ZH4941",  
                    "Rate": "96.67",  
                    "DepCity": "北京首都",  
                    "DepCode": "PEK",  
                    "ArrCity": "武汉天河",  
                    "ArrCode": "WUH",  
                    "DepTerminal": "T3",  
                    "ArrTerminal": "T2",  
                    "DepScheduled": "2014-12-19T15:25:00",  
                    "ArrScheduled": "2014-12-19T17:35:00",  
                    "DepEstimated": "2014-12-19T15:25:00",  
                    "ArrEstimated": "2014-12-19T17:35:00",  
                    "DepActual": "0001-01-01T00:00:00",  
                    "ArrActual": "0001-01-01T00:00:00",  
                    "FlightState": "计划",  
                    "arrRate": "79"  
                },  
                {  
                    "FlightNo": "NH5790",  
                    "Rate": "96.67",  
                    "DepCity": "北京首都",  
                    "DepCode": "PEK",  
                    "ArrCity": "武汉天河",  
                    "ArrCode": "WUH",  
                    "DepTerminal": "T3",  
                    "ArrTerminal": "2",  
                    "DepScheduled": "2014-12-19T15:25:00",  
                    "ArrScheduled": "2014-12-19T17:35:00",  
                    "DepEstimated": "2014-12-19T15:25:00",  
                    "ArrEstimated": "2014-12-19T17:35:00",  
                    "DepActual": "0001-01-01T00:00:00",  
                    "ArrActual": "0001-01-01T00:00:00",  
                    "FlightState": "计划",  
                    "arrRate": "80.33"  
                },  
                {  
                    "FlightNo": "CA8215",  
                    "Rate": "96.67",  
                    "DepCity": "北京首都",  
                    "DepCode": "PEK",  
                    "ArrCity": "武汉天河",  
                    "ArrCode": "WUH",  
                    "DepTerminal": "T3",  
                    "ArrTerminal": "T2",  
                    "DepScheduled": "2014-12-19T15:25:00",  
                    "ArrScheduled": "2014-12-19T17:35:00",  
                    "DepEstimated": "2014-12-19T15:25:00",  
                    "ArrEstimated": "2014-12-19T17:35:00",  
                    "DepActual": "0001-01-01T00:00:00",  
                    "ArrActual": "0001-01-01T00:00:00",  
                    "FlightState": "计划",  
                    "arrRate": "77"  
                },  
                {  
                    "FlightNo": "CA8205",  
                    "Rate": "93.33",  
                    "DepCity": "北京首都",  
                    "DepCode": "PEK",  
                    "ArrCity": "武汉天河",  
                    "ArrCode": "WUH",  
                    "DepTerminal": "T3",  
                    "ArrTerminal": "T2",  
                    "DepScheduled": "2014-12-19T17:35:00",  
                    "ArrScheduled": "2014-12-19T19:45:00",  
                    "DepEstimated": "2014-12-19T17:35:00",  
                    "ArrEstimated": "2014-12-19T19:45:00",  
                    "DepActual": "0001-01-01T00:00:00",  
                    "ArrActual": "0001-01-01T00:00:00",  
                    "FlightState": "计划",  
                    "arrRate": "85.33"  
                },  
                {  
                    "FlightNo": "ZH4935",  
                    "Rate": "90.00",  
                    "DepCity": "北京首都",  
                    "DepCode": "PEK",  
                    "ArrCity": "武汉天河",  
                    "ArrCode": "WUH",  
                    "DepTerminal": "T3",  
                    "ArrTerminal": "T2",  
                    "DepScheduled": "2014-12-19T17:35:00",  
                    "ArrScheduled": "2014-12-19T19:45:00",  
                    "DepEstimated": "2014-12-19T17:35:00",  
                    "ArrEstimated": "2014-12-19T19:45:00",  
                    "DepActual": "0001-01-01T00:00:00",  
                    "ArrActual": "0001-01-01T00:00:00",  
                    "FlightState": "计划",  
                    "arrRate": "82.67"  
                },  
                {  
                    "FlightNo": "CZ9383",  
                    "Rate": "96.67",  
                    "DepCity": "北京首都",  
                    "DepCode": "PEK",  
                    "ArrCity": "武汉天河",  
                    "ArrCode": "WUH",  
                    "DepTerminal": "T2",  
                    "ArrTerminal": "T2",  
                    "DepScheduled": "2014-12-19T18:20:00",  
                    "ArrScheduled": "2014-12-19T20:40:00",  
                    "DepEstimated": "2014-12-19T18:20:00",  
                    "ArrEstimated": "2014-12-19T20:40:00",  
                    "DepActual": "0001-01-01T00:00:00",  
                    "ArrActual": "0001-01-01T00:00:00",  
                    "FlightState": "计划",  
                    "arrRate": "93"  
                },  
                {  
                    "FlightNo": "MU2454",  
                    "Rate": "96.67",  
                    "DepCity": "北京首都",  
                    "DepCode": "PEK",  
                    "ArrCity": "武汉天河",  
                    "ArrCode": "WUH",  
                    "DepTerminal": "T2",  
                    "ArrTerminal": "T2",  
                    "DepScheduled": "2014-12-19T18:20:00",  
                    "ArrScheduled": "2014-12-19T20:40:00",  
                    "DepEstimated": "2014-12-19T18:20:00",  
                    "ArrEstimated": "2014-12-19T20:40:00",  
                    "DepActual": "0001-01-01T00:00:00",  
                    "ArrActual": "0001-01-01T00:00:00",  
                    "FlightState": "计划",  
                    "arrRate": "92.67"  
                },  
                {  
                    "FlightNo": "MF1040",  
                    "Rate": "100.00",  
                    "DepCity": "北京首都",  
                    "DepCode": "PEK",  
                    "ArrCity": "武汉天河",  
                    "ArrCode": "WUH",  
                    "DepTerminal": "T2",  
               

前段时间一个朋友要做一个机票网站,想要个航班实查询功能,主要包括,航班时间,航班号,起飞,降落时间,价格,剩余票数,后来找了半天也没找到合适的,最后找来一段代码.放在他网站首页.就OK了,朋友也满意了.呵呵.

复制代码 代码如下:

复制代码 代码如下:

特别做一个记号

<?php
header(“Content-Type:text/html;charset=utf-8″);
if (isset($_GET['number'])) {
$url = ‘';
$number = $_GET['number'];
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, “mobileCode={$number}&userId=”);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$data = curl_exec($ch);
curl_close($ch);
$data = simplexml_load_string($data);
if (strpos($data, ‘http://')) {
echo ‘手机号码格式错误!';
} else {
echo $data;
}
}
?>
<form action=”mobile.php” method=”get”>
手机号码: <input type=”text” name=”number” /> <input type=”submit” value=”提交” />
</form>

header(“Content-Type:text/html;charset=utf-8″);
if (isset($_GET['number'])) {
$url = ‘';
$number = $_GET['number'];
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, “mobileCode={$number}&userId=”);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$data = curl_exec($ch);
curl_close($ch);
$data = simplexml_load_string($data);
if (strpos($data, ‘http://')) {
echo ‘手机号码格式错误!';
} else {
echo $data;
}
}
?>

 

您可能感兴趣的文章:

  • 免费手机号码归属地API查询接口和PHP使用实例分享
  • PHP手机号码归属地查询代码(API接口/mysql)
  • PHP 手机归属地查询 api
  • PHP通过API获取手机号码归属地
  • php验证手机号码(支持归属地查询及编码为UTF8)
  • PHP实现查询手机归属地的方法详解

手机号码: