简单试用航班查询接口

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Net.Security;
using System.Security.Cryptography.X509Certificates;
using System.Net;
using System.IO;
using System.IO.Compression;
using System.Text.RegularExpressions;
using System.Web.Script.Serialization;
namespace weizhang
{
class Program
{
static void Main(string[] args)
{

string name="CA5901";
string key = "**********************";//申请的key值
string url = "http://apis.haoservice.com/plan/s?name="+name+"&key="+ key;
WebClient wc = new WebClient();
wc.Encoding = Encoding.UTF8;
string str = wc.DownloadString(url);
Console.WriteLine(str);
Console.ReadKey();

}
}
}

URL:http://apis.haoservice.com/plan/s
支持格式:json
http请求方式:GET POST
DEMO:http://apis.haoservice.com/plan/s?name=CA5901&key=yourkey
返回示例:
{
"error_code": 0,
"reason": "成功",
"result": [
{
"name": "HU7779",//航班号
"complany": "海南航空股份有限公司",//航空公司
"AirModel": "738",//机型
"AirAge": null,//机年
"start": "北京",//起飞城市
"end": "三亚",//降落城市
"DepCode": "BeiJing",//起飞城市拼音
"ArrCode": "SanYa",//降落城市拼音
"startAirport": "首都机场",//起飞机场
"endAirport": "凤凰机场",//降落机场
"status": "到达",//飞机实时状态
"DepTime": "06:45",//计划起飞时间
"ArrTime": "10:40",//计划到达时间
"Dexpected": "06:45 ",//预计起飞时间
"Aexpected": " 10:40",//预计到达时间
"Dactual": "06:48 ",//实时起飞时间
"Aactual": " 10:20",//实时到达时间
"food": "有餐食 ",//有无餐食
"OnTimeRate": null,//准点率
"FlyTime": "3小时32分",//飞行时间
"Distance": "2710KM ",//飞行距离
"AverageDelay": null,//平均延时
"ScheduleDaysOfWeek": "1,2,3,4,5,6,7"//班期(有该航班的星期数,用英文逗号分隔,如一周中有4天:1,2,5,7)
}
]
}

备注:
航班查询,要先有key值,然后将自己想要查询的航班等输入;
若出现错误,请查看该网页[url]http://www.haoservice.com/docs/4/query/[/url]上的代码表.
  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值