基于php的全国公交网接口调用代码实例.docVIP

  • 6
  • 0
  • 约3.57千字
  • 约 4页
  • 2017-06-12 发布于北京
  • 举报

基于php的全国公交网接口调用代码实例.doc

基于php的全国公交网接口调用代码实例 代码描述:基于php的全国公交网接口调用代码实例 代码平台:聚合数据 !--?php // +---------------------------------------------------------------------- // | JuhePHP [ NO ZUO NO DIE ] // +---------------------------------------------------------------------- // | Copyright (c) 2010-2015 All rights reserved. // +---------------------------------------------------------------------- // | Author: Juhedata info@-- // +---------------------------------------------------------------------- ? //---------------------------------- // 全国公交及路径规划查询调用示例代码 - 聚合数据 // 在线接口文档:/docs/135 //---------------------------------- ? header(Content-type:text/html;charset=utf-8); ? ? //配置您申请的appkey $appkey = *********************; ? ? ? ? //************1.公交线路查询************ $url = /189/bus/busline; $params = array( ??????key = $appkey,//应用APPKEY(应用详细页查询) ??????dtype = ,//返回数据的格式,xml或json,默认json ??????city = ,//城市名称(如:苏州)或者城市代码(如:0512) ??????bus = ,//公交线路 ); $paramstring = http_build_query($params); $content = juhecurl($url,$paramstring); $result = json_decode($content,true); if($result){ ????if($result[error_code]==0){ ????????print_r($result); ????}else{ ????????echo $result[error_code].:.$result[reason]; ????} }else{ ????echo 请求失败; } //************************************************** ? ? ? ? //************2.公交站台经往车辆查询************ $url = /189/bus/station; $params = array( ??????key = $appkey,//应用APPKEY(应用详细页查询) ??????dtype = ,//返回数据的格式,xml或json,默认json ??????city = ,//城市名称(如:苏州)或者城市代码(如:0512) ??????station = ,//公交站台名称 ); $paramstring = http_build_query($params); $content = juhecurl($url,$paramstring); $result = json_decode($content,true); if($result){ ????if($result[error_code]==0){ ????????print_r($result); ????}else{ ????????echo $result[error_code].:.$result[reason]; ????} }else{ ????echo 请求失败; } //************************************************** ? ? ? ? //************3.公交线路换乘方案************ $url = /189/bus/transfer; $params = array( ??????key = $appkey,//应用APPKEY(应用详细页查询) ??????dtype = ,//返回数据的格式,xml或

文档评论(0)

1亿VIP精品文档

相关文档