• 火车票查询


    using System;

    using System.Text;

    using System.Net;

    namespace trian ticket

    {

    class Program

    {

    static void Main(string[] args)

    {

    string key = "52bd00811f3442d8a6cca4ed6198316a";//申请的key值

    string date="2014-09-28";//日期

    string from="上海";//出发城市名称
    string to="温州";//到达城市名称

    string url = "http://apis.haoservice.com/lifeservice/train/ypcx?date="+date+"&from="+from+"&to="+to+"&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/lifeservice/train/ypcx

    支持格式:json

    http请求方式:GET

    DEMO:http://apis.haoservice.com/lifeservice/train/ypcx?date=2014-08-27&from=上海&to=温州&key=您申请的APPKEY

    返回结果:
    {
    "error_code":"0",
    "reason":"Success",
    "result":[{
    "train_no": "D2287", /*车次*//
    "start_station_name": "上海虹桥", /*车次始发站*/
    "end_station_name": "深圳北", /*车次终点站*/
    "from_station_name": "上海虹桥", /*出发站*/
    "to_station_name": "温州南", /*到达站*/
    "start_time": "06:25", /*出发时间*/
    "arrive_time": "10:53", /*到达时间*/
    "train_class_name": "动车", /*车次类型*/
    "day_difference": "0", /*历时天数*/
    "lishi": "04:28", /*总历时时间*/
    "gr_num": "--", /*高级软卧:-- 说明无该席位*/
    "qt_num": "--", /*其他*/
    "rw_num": "--", /*软卧*/
    "rz_num": "--", /*软座*/
    "tz_num": "--", /*特等座*/
    "wz_num": "无", /*无座*/
    "yw_num": "--", /*硬卧*/
    "yz_num": "--", /*硬座*/
    "ze_num": "无", /*二等座*/
    "zy_num": "无", /*一等座*/
    "swz_num": "--" /*商务座*/
    },
    ......
    {
    "train_no": "G7501",
    "start_station_name": "上海虹桥",
    "end_station_name": "苍南",
    "from_station_name": "上海虹桥",
    "to_station_name": "温州南",
    "start_time": "07:00",
    "arrive_time": "11:00",
    "train_class_name": "",
    "day_difference": "0",
    "lishi": "04:00",
    "gr_num": "--",
    "qt_num": "--",
    "rw_num": "--",
    "rz_num": "--",
    "tz_num": "--",
    "wz_num": "165",
    "yw_num": "--",
    "yz_num": "--",
    "ze_num": "无",
    "zy_num": "无",
    "swz_num": "15"
    }]
    }
    备注说明
    即日起至7月1日铁路部门执行调整列车运行图,全国列车开行密度、运行时速、停靠时刻都将发生变化

    备注:

    先在网页 (http://www.haoservice.com/docs/25)上申请key值,填入参数.

    若有错误,请参照一下代码表

    错误代码表:

    返回码 说明

    0 成功

    10001 错误的请求KEY

    10002 该KEY无请求权限

    10003 KEY过期

    10004 错误的SDK KEY

    10005 应用未审核超时,请提交认证

    10007 未知的请求源,(服务器没有获取到IP地址)

    10008 被禁止的IP

    10009 被禁止的KEY

    10011 当前IP请求超过限制

    10012 当前Key请求超过限制

    10013 测试KEY超过请求限制

    10020 接口维护

    10021 接口停用

    10022 appKey按需剩余请求次数为零

    10023 请求IP无效

    10024 网络错误

    10025 没有查询到结果

  • 相关阅读:
    ant-design中日历之自定义头部加上返回今日
    centos7(虚拟机)下安装nginx
    centos7(虚拟机)下安装redis
    log4net
    Autofac
    Utilities
    实体转换类
    CG——Possion Image Editing
    CSC3002学习笔记
    serving 源码
  • 原文地址:https://www.cnblogs.com/haoservice/p/3992908.html
Copyright © 2020-2023  润新知