http(s)://api.hanvon.com/rt/ws/v1/ocr/trainticket/recg?key=yourKey&code=ea044649-4fe6-4ca6-9204-b900ec3dda06
key:请到开发中心-->应用管理-->Key管理,在您的Key列表中找到对应的Key
code:code为固定值,直接使用url中的code即可
字段 | 描述 |
---|---|
uid | 您的服务器IP地址。 |
image | 火车票图像的base64串 |
<?php //定义请求的url地址 $url = "http://api.hanvon.com/rt/ws/v1/ocr/trainticket/recg?key=your_android_key&code=ea044649-4fe6-4ca6-9204-b900ec3dda06"; //模拟发送POST请求(CURL四步走) //第一步:初始化curl $ch = curl_init(); //第二步:设置相关参数 //设置请求的url地址 curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); //禁止SSL证书的校检功能 curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false); //模拟发送POST请求 curl_setopt($ch, CURLOPT_POST, 1); $image=base64_encode(file_get_contents('1.jpg')); var_dump($image); $arr = array ('uid'=>'0.0.0.0','image'=>$image); $data = json_encode($arr); curl_setopt($ch, CURLOPT_POSTFIELDS, $data); //第三步:执行curl $output = curl_exec($ch); //判断输出结果是否异常 if($output===false) { echo curl_error($ch); } else { var_dump($output); } //第四步:关闭curl curl_close($ch); ?>
字段 | 父字段 | 描述 |
---|---|---|
code | response | 返回码 |
result | response | 消息内容 |
trainCode | response | 编号 |
source | response | 出发站 |
destination | response | 到达站 |
seatType | response | 坐席 |
passengerName | response | 姓名 |
trainNo | response | 车次 |
leaveTime | response | 时间 |
seatNo | response | 座位号 |
money | response | 金额 |
passengerId | response | 身份证号 |
bottomCode | response | 底部编码 |
ticketStation | response | 售票点 |
increasedPrice | response | 加收票价 |
hardseatPrice | response | 硬座票价 |
ticketInfo | response | 补票信息 |
handlingFees | response | 手续费 |
total | response | 合计 |
Success:
Failure:
1. 票据尽可能充满整个画面。
2. 拍摄时,请保持光线充足,不要有阴影和反光。
3. 请对焦后进行拍摄,尽量避免抖动。
4. 照片大小请控制在200K以内。