JQ + PHP + TrackMore物流信息跟踪
在使用之前,您需要先去trackmore官方网站申请API_KEY,传送门:TrackMore
html
<script type="text/javascript" src="/plugins/TrackMore/trackmore.js"></script>
<a href="javascript:;" onclick="trackmore.query('运单号','快递名称')">TrackMore</a>
<!--
快递名称参见cfg.php,用于映射快递公司代码
-->
<div id="queryContext" class="flo" style="display: none;"></div>
<div id="queryContextbg" style="display: none;"></div>
trackmore.js
var trackmore = {
init:function(){
/*加载样式表*/
var url='/plugins/TrackMore/skin/style.css?'+new Date().getTime();
var link = document.createElement("link");
link.rel = "stylesheet";
link.type = "text/css";
link.href = url;
document.getElementsByTagName("head")[0].appendChild(link);
var csstype = "flo";
/*
fix 固定 flo 浮动
默认浮动,不需要在页面添加容器
使用固定的方式在页面容器中指定class="fix"
*/
var cont = $("#queryContext");
if(cont.length<1){
$(document.body).append('<div id="queryContext" class="' + csstype + '"></div>');
cont = $("#queryContext");
}
if($("#queryContextbg").length<1){
$(document.body).append('<div id="queryContextbg"></div>');
}
cont.hide();
$("#queryContextbg").hide();
},
query:function(codenum,codename){
var cont=$("#queryContext");
if(cont.length<1)
{
$(document.body).append('<div id="queryContext"></div>');
cont=$("#queryContext");
}
if(codenum.length<1 || codename.length<1){
shtml='快递单号或者物流类型为空';
retrun;
}
Ajax.call('/plugins/TrackMore/trackmore_post.php','num=' + codenum + '&com=' + codename,function(result){
if(result.meta.code == 200){
var status;
var origin_info = result.data.items[0].origin_info;
var shtml = '<div class="header">';
shtml += '<div class="th">';
shtml += '<h2>物流轨迹</h2>';
shtml += '<span>' + codename + ':' + codenum + '</span>';
shtml += '<a class="close" href="#" onclick="kdniao.close()"></a>';
shtml += '</div>';
shtml += '</div>';
shtml += '<div class="tbody">';
shtml += '<table class="kd_tb"><thead><tr><th class="th" colspan="4"></th></tr></thead><tbody>';
for(i=0;i<origin_info.trackinfo.length;i++){
switch(i){
case origin_info.trackinfo.length-1:
status = "fir";
break;
case 0:
status = "end";
break;
default:
status = "mid";
break;
}
var sigleinfo = origin_info.trackinfo[i]
sigleinfo_date = sigleinfo.Date.split(" ");
shtml += '<tr><td class="td1"><b class="' + status + '"></b></td><td>' + sigleinfo_date[0] + '</td><td>' + sigleinfo_date[1] + '</td><td>' + sigleinfo.Details + '</td><td>' + sigleinfo.StatusDescription + '</td>';
}
shtml += '</tbody></table>';
shtml += '</div>';
shtml += '<div class="footer"><div class="info">以上信息由物流公司提供,如无跟踪信息或有疑问,请咨询对应的物流公司</div></div>';
cont.html(shtml).show();
}
} , 'POST', 'JSON')
},
close:function(){
$("#queryContext").hide();
$("#queryContextbg").hide();
}
}
trackmore.init();
trackmore_cfg.php
<?php
header("content-type:text/html;charset=utf-8");
switch ($getcom){
case "韵达速递":
$postcom = "yunda";
break;
case "中通快递":
$postcom = "zto";
break;
case "申通快递":
$postcom = "sto";
break;
case "圆通快递":
$postcom = "yto";
break;
case "顺丰速递":
$postcom = "sf-express";
break;
case "EMS":
$postcom = "china-ems";
break;
case "天天快递":
$postcom = "ttkd";
break;
default:
$postcom = "";
break;
}
?>
trackmore_post.php
<?php
header("content-type:text/html;charset=utf-8"); $getcom = trim($_POST["com"]);
$getnum = trim($_POST["num"]);
include_once('trackmore_cfg.php');
include_once("track.class.php"); /*
* 这里是正式生产环境下使用的内容
$track = new Trackingmore;
$extraInfo['lang'] = 'cn';
$track = $track -> getRealtimeTrackingResults($postcom,$getnum,$extraInfo);
$return_json = json_encode($track);
*/
/*
* 这里是模拟trackmore返回数据
*/
$return_json = include('test_result.php'); echo $return_json;
?>
track.class.php
<?php
class Trackingmore{
const API_BASE_URL = 'http://api.trackingmore.com/v2/';
const ROUTE_CARRIERS = 'carriers/';//获取运输商简码
const ROUTE_CARRIERS_DETECT = 'carriers/detect';//通过跟踪代码检测载波
const ROUTE_TRACKINGS = 'trackings';//接口主路径
const ROUTE_LIST_ALL_TRACKINGS = 'trackings/get';//获取多个运单号的物流信息
const ROUTE_CREATE_TRACKING = 'trackings/post';//创建单个运单号
const ROUTE_TRACKINGS_BATCH = 'trackings/batch'; //创建多个运单号
const ROUTE_TRACKINGS_REALTIME = 'trackings/realtime';//获取单个运单号实时物流信息
const ROUTE_TRACKINGS_RELETE = 'trackings/delete';//删除多个运单号
const ROUTE_TRACKINGS_UPDATE = 'trackings/update';//修改运输商简码
const ROUTE_TRACKINGS_GETUSEINFO = 'trackings/getuserinfo';//查询用户剩余额度
const ROUTE_TRACKINGS_GETSTATUS = 'trackings/getstatusnumber';//查看不同状态快递数量
const ROUTE_TRACKINGS_NOTUPDATE = 'trackings/notupdate';//设置部分单号不再更新
const ROUTE_TRACKINGS_REMOTE = 'trackings/remote';//查询收货地址是否偏远
const ROUTE_TRACKINGS_COSTTIME = 'trackings/costtime';//获取成本时间迭代结果
const ROUTE_TRACKINGS_UPDATEMORE = 'trackings/updatemore';//修改多个运单号附加信息。如:订单号,商品标题,快递状态等。
protected $apiKey = 'your api_key';//API Key protected function _getApiData($route, $method = 'GET', $sendData = array()){
$method = strtoupper($method);
$requestUrl = self::API_BASE_URL.$route;
$curlObj = curl_init();
curl_setopt($curlObj, CURLOPT_URL,$requestUrl);
if($method == 'GET'){
curl_setopt($curlObj, CURLOPT_HTTPGET,true);
}elseif($method == 'POST'){
curl_setopt($curlObj, CURLOPT_POST, true);
}elseif ($method == 'PUT'){
curl_setopt($curlObj, CURLOPT_CUSTOMREQUEST, "PUT");
}else{
curl_setopt($curlObj, CURLOPT_CUSTOMREQUEST, $method);
}
curl_setopt($curlObj, CURLOPT_CONNECTTIMEOUT, 10);
curl_setopt($curlObj, CURLOPT_TIMEOUT, 90);
curl_setopt($curlObj, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curlObj, CURLOPT_HEADER, 0);
$headers = array(
'Trackingmore-Api-Key: ' . $this->apiKey,
'Content-Type: application/json',
);
if($sendData){
$dataString = json_encode($sendData);
curl_setopt($curlObj, CURLOPT_POSTFIELDS, $dataString);
$headers[] = 'Content-Length: ' . strlen($dataString);
}
curl_setopt($curlObj, CURLOPT_HTTPHEADER, $headers);
$response = curl_exec($curlObj);
curl_close($curlObj);
unset($curlObj);
return $response;
} // List all carriers
public function getCarrierList(){
$returnData = array();
$requestUrl = self::ROUTE_CARRIERS;
$result = $this->_getApiData($requestUrl, 'GET');
if ($result) {
$returnData = json_decode($result, true);
}
return $returnData;
} /*Detect a carrier by tracking code
* @param string $trackingNumber Tracking number
* @return array
*/
public function detectCarrier($trackingNumber)
{
$returnData = array();
$requestUrl = self::ROUTE_CARRIERS_DETECT;
$sendData['tracking_number'] = $trackingNumber;
$result = $this->_getApiData($requestUrl, 'POST',$sendData);
if ($result) {
$returnData = json_decode($result, true);
}
return $returnData;
} /**
* List all trackings
* @access public
* @param int $numbers Tracking numbers,eg:$numbers = LY044217709CN,UG561422482CN (optional)
* @param int $orders Tracking order,eg:$orders = #123 (optional)
* @param int $page Page to display (optional)
* @param int $limit Items per page (optional)
* @param int $createdAtMin Start date and time of trackings created (optional)
* @param int $createdAtMax End date and time of trackings created (optional)
* @param int $update_time_min Start date and time of trackings updated (optional)
* @param int $update_time_max End date and time of trackings updated (optional)
* @param int $order_created_time_min Start date and time of order created (optional)
* @param int $order_created_time_max End date and time of order created (optional)
* @param int $lang Language,eg:$lang=cn(optional)
* @return array
*/
public function getTrackingsList($numbers = "",$orders = "",$page = 1,$limit = 100,$createdAtMin = 0,$createdAtMax = 0,$update_time_min = 0,$update_time_max = 0,$order_created_time_min = 0,$order_created_time_max = 0,$lang = "en"){
$returnData = array();
$sendData = array();
$requestUrl = self::ROUTE_LIST_ALL_TRACKINGS;
$createdAtMax = !empty($createdAtMax)?$createdAtMax:time();
$update_time_max = !empty($update_time_max)?$update_time_max:time();
$order_created_time_max = !empty($order_created_time_max)?$order_created_time_max:time();
$sendData['page'] = $page;
$sendData['limit'] = $limit;
$sendData['created_at_min'] = $createdAtMin;
$sendData['created_at_max'] = $createdAtMax;
$sendData['update_time_min'] = $update_time_min;
$sendData['update_time_max'] = $update_time_max;
$sendData['order_created_time_min'] = $order_created_time_min;
$sendData['order_created_time_max'] = $order_created_time_max;
$sendData['lang'] = $lang;
$sendData['numbers'] = $numbers;
$sendData['orders'] = $orders;
$result = $this->_getApiData($requestUrl, 'GET', $sendData);
if ($result) {
$returnData = json_decode($result);
}
return $returnData;
} /**
* Create a tracking item
* @access public
* @param string $trackingNumber Tracking number
* @param string $carrierCode Carrier code
* @param array $extraInfo (Title,Customer name,email,order ID,customer phone,order create time,destination code,tracking ship date,tracking postal code,language) (optional)
* @return array
*/
public function createTracking($carrierCode,$trackingNumber,$extraInfo = array()){
$returnData = array();
$sendData = array();
$requestUrl = self::ROUTE_CREATE_TRACKING; $sendData['tracking_number'] = $trackingNumber;
$sendData['carrier_code'] = $carrierCode;
$sendData['title'] = !empty($extraInfo['title'])?$extraInfo['title']:null;
$sendData['logistics_channel'] = !empty($extraInfo['logistics_channel'])?$extraInfo['logistics_channel']:null;
$sendData['customer_name'] = !empty($extraInfo['customer_name'])?$extraInfo['customer_name']:null;
$sendData['customer_email'] = !empty($extraInfo['customer_email'])?$extraInfo['customer_email']:null;
$sendData['order_id'] = !empty($extraInfo['order_id'])?$extraInfo['order_id']:null;
$sendData['customer_phone'] = !empty($extraInfo['customer_phone'])?$extraInfo['customer_phone']:null;
$sendData['order_create_time'] = !empty($extraInfo['order_create_time'])?$extraInfo['order_create_time']:null;
$sendData['destination_code'] = !empty($extraInfo['destination_code'])?$extraInfo['destination_code']:'';
$sendData['tracking_ship_date'] = !empty($extraInfo['tracking_ship_date'])?$extraInfo['tracking_ship_date']:null;
$sendData['tracking_postal_code'] = !empty($extraInfo['tracking_postal_code'])?$extraInfo['tracking_postal_code']:"";
$sendData['lang'] = !empty($extraInfo['lang'])?$extraInfo['lang']:"en"; $result = $this->_getApiData($requestUrl, 'POST', $sendData);
if ($result) {
$returnData = json_decode($result, true);
}
return $returnData;
} /**
* Create multiple trackings.
* @access public
* @param array $multipleData (Multiple tracking number,carrier code,title,customer name,customer email,order id,destination code,customer phone,order create time,tracking ship date,tracking postal code,special number destination,language)
* @return array
*/
public function createMultipleTracking($multipleData){
$returnData = array();
$sendData = array();
$requestUrl = self::ROUTE_TRACKINGS_BATCH;
if(!empty($multipleData)){
foreach($multipleData as $val){
$items = array();
$items['tracking_number'] = !empty($val['tracking_number'])?$val['tracking_number']:null;
$items['carrier_code'] = !empty($val['carrier_code'])?$val['carrier_code']:null;
$items['title'] = !empty($val['title'])?$val['title']:null;
$items['logistics_channel'] = !empty($val['logistics_channel'])?$val['logistics_channel']:null;
$items['customer_name'] = !empty($val['customer_name'])?$val['customer_name']:null;
$items['customer_email'] = !empty($val['customer_email'])?$val['customer_email']:null;
$items['order_id'] = !empty($val['order_id'])?$val['order_id']:null;
$items['destination_code'] = !empty($val['destination_code'])?$val['destination_code']:null;
$items['customer_phone'] = !empty($val['customer_phone'])?$val['customer_phone']:null;
$items['order_create_time'] = !empty($val['order_create_time'])?$val['order_create_time']:null;
$items['tracking_ship_date'] = !empty($val['tracking_ship_date'])?$val['tracking_ship_date']:null;
$items['tracking_postal_code'] = !empty($val['tracking_postal_code'])?$val['tracking_postal_code']:null;
$items['specialNumberDestination'] = !empty($val['specialNumberDestination'])?$val['specialNumberDestination']:null;
$items['lang'] = !empty($val['lang'])?$val['lang']:'en';
$sendData[] = $items;
}
} $result = $this->_getApiData($requestUrl, 'POST', $sendData);
if ($result) {
$returnData = json_decode($result, true);
}
return $returnData;
} /**
* Get tracking results of a single tracking
* @access public
* @param string $trackingNumber Tracking number
* @param string $carrierCode Carrier code
* @param string $lang language
* @return array
*/
public function getSingleTrackingResult($carrierCode,$trackingNumber,$lang='en'){
$returnData = array();
$requestUrl = self::ROUTE_TRACKINGS.'/'.$carrierCode.'/'.$trackingNumber.'/'.$lang;
$result = $this->_getApiData($requestUrl, 'GET');
if ($result) {
$returnData = json_decode($result, true);
}
return $returnData;
} /**
* Update Tracking item
* @access public
* @param string $trackingNumber Tracking number
* @param string $carrierCode Carrier code
* @param array $extraInfo (Title,Customer name,email,order ID,customer phone,destination code,status) (optional)
* @return array
*/
public function updateTrackingItem($carrierCode,$trackingNumber,$extraInfo){
$returnData = array();
$requestUrl = self::ROUTE_TRACKINGS.'/'.$carrierCode.'/'.$trackingNumber;
$sendData['title'] = !empty($extraInfo['title'])?$extraInfo['title']:null;
$sendData['logistics_channel'] = !empty($extraInfo['logistics_channel'])?$extraInfo['logistics_channel']:null;
$sendData['customer_name'] = !empty($extraInfo['customer_name'])?$extraInfo['customer_name']:null;
$sendData['customer_email'] = !empty($extraInfo['customer_email'])?$extraInfo['customer_email']:null;
$sendData['customer_phone'] = !empty($extraInfo['customer_phone'])?$extraInfo['customer_phone']:null;
$sendData['order_id'] = !empty($extraInfo['order_id'])?$extraInfo['order_id']:null;
$sendData['destination_code']= !empty($extraInfo['destination_code'])?$extraInfo['destination_code']:null;
$sendData['status']= !empty($extraInfo['status'])?$extraInfo['status']:null;
$result = $this->_getApiData($requestUrl, 'PUT',$sendData);
if ($result) {
$returnData = json_decode($result, true);
}
return $returnData;
} /**
* Delete a tracking item
* @access public
* @param string $trackingNumber Tracking number
* @param string $carrierCode Carrier code
* @return array
*/
public function deleteTrackingItem($carrierCode,$trackingNumber){
$returnData = array();
$requestUrl = self::ROUTE_TRACKINGS.'/'.$carrierCode.'/'.$trackingNumber;
$result = $this->_getApiData($requestUrl, 'DELETE');
if ($result) {
$returnData = json_decode($result, true);
}
return $returnData;
} /**
* Get realtime tracking results of a single tracking
* @access public
* @param string $trackingNumber Tracking number
* @param string $carrierCode Carrier code
* @param array $extraInfo (Destination_code,Tracking_ship_date Customer_email,Tracking_postal_code,SpecialNumberDestination,order,lang) (optional)
* @return array
*/
public function getRealtimeTrackingResults($carrierCode,$trackingNumber,$extraInfo=array()){
$returnData = array();
$requestUrl = self::ROUTE_TRACKINGS_REALTIME;
$sendData['tracking_number'] = $trackingNumber;
$sendData['carrier_code'] = $carrierCode;
$sendData['destination_code'] = !empty($extraInfo['destination_code'])?$extraInfo['destination_code']:null;
$sendData['tracking_ship_date'] = !empty($extraInfo['tracking_ship_date'])?$extraInfo['tracking_ship_date']:null;
$sendData['order_create_time'] = !empty($extraInfo['order_create_time'])?$extraInfo['order_create_time']:null;
$sendData['tracking_postal_code'] = !empty($extraInfo['tracking_postal_code'])?$extraInfo['tracking_postal_code']:null;
$sendData['specialNumberDestination'] = !empty($extraInfo['specialNumberDestination'])?$extraInfo['specialNumberDestination']:null;
$sendData['order'] = !empty($extraInfo['order'])?$extraInfo['order']:null;
$sendData['lang'] = !empty($extraInfo['lang'])?$extraInfo['lang']:null;
$result = $this->_getApiData($requestUrl, 'POST',$sendData);
if ($result) {
$returnData = json_decode($result, true);
}
return $returnData;
} /**
* delete multiple tracking
* @access public
* @param array $multipleData (tracking number,carrier code)
* @return array
*/
public function deleteMultipleTracking($multipleData){
$returnData = array();
$sendData = array();
$requestUrl = self::ROUTE_TRACKINGS_RELETE;
if(!empty($multipleData)){
foreach ($multipleData as $val){
$items = array();
$items['tracking_number'] = !empty($val['tracking_number'])?$val['tracking_number']:null;
$items['carrier_code'] = !empty($val['carrier_code'])?$val['carrier_code']:null;
$sendData[] = $items;
}
}
$result = $this->_getApiData($requestUrl, 'POST', $sendData);
if ($result) {
$returnData = json_decode($result, true);
}
return $returnData;
} /**
* update carrier code
* @access public
* @param string $trackingNumber Tracking number
* @param string $carrierCode Carrier code
* @param string $carrierCode Update carrier code
* @return array
*/
public function updateCarrierCode($tracking_number,$carrier_code,$update_carrier_code){
$returnData = array();
$sendData = array();
$requestUrl = self::ROUTE_TRACKINGS_UPDATE;
$sendData["tracking_number"] = $tracking_number;
$sendData["carrier_code"] = $carrier_code;
$sendData["update_carrier_code"] = $update_carrier_code;
$result = $this->_getApiData($requestUrl, 'POST', $sendData);
if ($result) {
$returnData = json_decode($result, true);
}
return $returnData;
} /**
* update carrier code
* @access public
* @return array
*/
public function getUserInfoBalance(){
$returnData = array();
$requestUrl = self::ROUTE_TRACKINGS_GETUSEINFO;
$result = $this->_getApiData($requestUrl, 'GET');
if ($result) {
$returnData = json_decode($result, true);
}
return $returnData;
} /**
* update carrier code
* @access public
* @param int $created_at_min Start date and time of trackings created (optional)
* @param int $created_at_max End date and time of trackings created (optional)
* @param int $order_created_time_min Start date and time of order created (optional)
* @param int $order_created_time_max End date and time of order created (optional)
* @return array
*/
public function getStatusNumberCount($created_at_min = 0,$created_at_max = 0,$order_created_time_min = 0,$order_created_time_max = 0){
$returnData = array();
$sendData = array();
$requestUrl = self::ROUTE_TRACKINGS_GETSTATUS;
$sendData["created_at_min"] = !empty($created_at_min)?$created_at_min:null;
$sendData["created_at_max"] = !empty($created_at_max)?$created_at_max:time();
$sendData["order_created_time_min"] = !empty($order_created_time_min)?$order_created_time_min:null;
$sendData["order_created_time_max"] = !empty($order_created_time_max)?$order_created_time_max:time();
$result = $this->_getApiData($requestUrl, 'GET',$sendData);
if ($result) {
$returnData = json_decode($result, true);
}
return $returnData;
} /**
* update carrier code
* @access public
* @param array $multipleData (tracking number,carrier code)
* @param string $carrierCode Carrier code
* @return array
*/
public function setNumberNotUpdate($multipleData){
$returnData = array();
$sendData = array();
$requestUrl = self::ROUTE_TRACKINGS_NOTUPDATE;
if(!empty($multipleData)){
foreach ($multipleData as $val){
$items = array();
$items['tracking_number'] = !empty($val['tracking_number'])?$val['tracking_number']:null;
$items['carrier_code'] = !empty($val['carrier_code'])?$val['carrier_code']:null;
$sendData[] = $items;
}
}
$result = $this->_getApiData($requestUrl, 'POST',$sendData);
if ($result) {
$returnData = json_decode($result, true);
}
return $returnData;
} /**
* update carrier code
* @access public
* @param array $multipleData (Country two code,Post code or city name,company),eg:array(0=>array("CN","518131","DHL"));
* @return array
*/
public function searchDeliveryIsRemote($multipleData){
$returnData = array();
$sendData = array();
$requestUrl = self::ROUTE_TRACKINGS_REMOTE;
if(!empty($multipleData)){
foreach ($multipleData as $val){
$items = array();
$items['country'] = !empty($val['country'])?$val['country']:null;
$items['postcode'] = !empty($val['postcode'])?$val['postcode']:null;
$items['company'] = !empty($val['company'])?$val['company']:null;
$sendData[] = $items;
}
}
$result = $this->_getApiData($requestUrl, 'POST',$sendData);
if ($result) {
$returnData = json_decode($result, true);
}
return $returnData;
} /**
* update carrier code
* @access public
* @param array $multipleData (Country two code,Post code or city name,company),eg:array(0=>array("CN","518131","DHL"));
* @return array
*/
public function getCarrierCostTime($multipleData){
$returnData = array();
$sendData = array();
$requestUrl = self::ROUTE_TRACKINGS_COSTTIME;
if(!empty($multipleData)){
foreach ($multipleData as $val){
$items = array();
$items['carrier_code'] = !empty($val['carrier_code'])?$val['carrier_code']:null;
$items['original'] = !empty($val['original'])?$val['original']:null;
$items['destination'] = !empty($val['destination'])?$val['destination']:null;
$sendData[] = $items;
}
}
$result = $this->_getApiData($requestUrl, 'POST',$sendData);
if ($result) {
$returnData = json_decode($result, true);
}
return $returnData;
} /**
* update carrier code
* @access public
* @param array $multipleData (Country two code,Post code or city name,company),eg:array(0=>array("CN","518131","DHL"));
* @return array
*/
public function updateMultipleTrackItem($multipleData){
$returnData = array();
$sendData = array();
$requestUrl = self::ROUTE_TRACKINGS_UPDATEMORE;
if(!empty($multipleData)){
foreach ($multipleData as $val){
$items = array();
$items['tracking_number'] = !empty($val['tracking_number'])?$val['tracking_number']:null;
$items['carrier_code'] = !empty($val['carrier_code'])?$val['carrier_code']:null;
$items['title'] = !empty($val['title'])?$val['title']:null;
$items['logistics_channel'] = !empty($val['logistics_channel'])?$val['logistics_channel']:null;
$items['customer_name'] = !empty($val['customer_name'])?$val['customer_name']:null;
$items['customer_email'] = !empty($val['customer_email'])?$val['customer_email']:null;
$items['order_id'] = !empty($val['order_id'])?$val['order_id']:null;
$items['destination_code'] = !empty($val['destination_code'])?$val['destination_code']:null;
$items['status'] = !empty($val['status'])?$val['status']:null;
$sendData[] = $items;
}
}
$result = $this->_getApiData($requestUrl, 'POST',$sendData);
if ($result) {
$returnData = json_decode($result, true);
}
return $returnData;
} }
?>
test_result.php,由于测试账号每20分钟仅可请求一次,我在这里将首次请求返回结果放在这个文件,模拟trackmore的返回数据
<?php
return "{
\"meta\" : {
\"code\" : 200,
\"type\" : \"Success\",
\"message\" : \"Success\"
},
\"data\" : {
\"items\" : [{
\"id\" : \"ef7b311fc15c7c1f58523a5076d8ad6f\",
\"tracking_number\" : \"3814040916275\",
\"carrier_code\" : \"yunda\",
\"order_create_time\" : \"\",
\"destination_code\" : \"\",
\"status\" : \"delivered\",
\"original_country\" : \"\",
\"itemTimeLength\" : 3,
\"stayTimeLength\" : 112,
\"service_code\" : null,
\"substatus\" : null,
\"last_mile_tracking_supported\" : null,
\"origin_info\" : {
\"ItemReceived\" : \"2018-02-03 21:51:25\",
\"ItemDispatched\" : null,
\"DepartfromAirport\" : null,
\"ArrivalfromAbroad\" : null,
\"CustomsClearance\" : null,
\"DestinationArrived\" : null,
\"weblink\" : \"http://yundaex.com/cn/index.php\",
\"phone\" : null,
\"carrier_code\" : \"yunda\",
\"trackinfo\" : [{
\"Date\" : \"2018-02-06 19:49:26\",
\"StatusDescription\" : \"快件已被 已签收 签收\",
\"Details\" : \"广东湛江公司北月便民寄存点分部\",
\"checkpoint_status\" : \"delivered\"
},{
\"Date\" : \"2018-02-06 12:04:47\",
\"StatusDescription\" : \"进行派件扫描;派送业务员:陈汉淇;联系电话:13078298668\",
\"Details\" : \"广东湛江公司北月便民寄存点分部\",
\"checkpoint_status\" : \"transit\"
},{
\"Date\" : \"2018-02-05 20:36:15\",
\"StatusDescription\" : \"进行快件扫描,将发往:广东湛江公司北月便民寄存点分部\",
\"Details\" : \"广东湛江公司\",
\"checkpoint_status\" : \"transit\"
},{
\"Date\" : \"2018-02-05 00:20:55\",
\"StatusDescription\" : \"从站点发出,本次转运目的地:广东湛江公司\",
\"Details\" : \"广东中山分拨中心\",
\"checkpoint_status\" : \"transit\"
},{
\"Date\" : \"2018-02-05 00:13:30\",
\"StatusDescription\" : \"在分拨中心进行卸车扫描\",
\"Details\" : \"广东中山分拨中心\",
\"checkpoint_status\" : \"transit\"
},{
\"Date\" : \"2018-02-04 05:07:20\",
\"StatusDescription\" : \"进行装车扫描,即将发往:广东中山分拨中心\",
\"Details\" : \"广东揭阳分拨中心\",
\"checkpoint_status\" : \"transit\"
},{
\"Date\" : \"2018-02-04 05:04:51\",
\"StatusDescription\" : \"在分拨中心进行称重扫描\",
\"Details\" : \"广东揭阳分拨中心\",
\"checkpoint_status\" : \"transit\"
},{
\"Date\" : \"2018-02-03 22:02:41\",
\"StatusDescription\" : \"进行下级地点扫描,将发往:广东湛江公司\",
\"Details\" : \"广东普宁南公司\",
\"checkpoint_status\" : \"transit\"
},{
\"Date\" : \"2018-02-03 21:51:25\",
\"StatusDescription\" : \"进行揽件扫描\",
\"Details\" : \"广东普宁南公司\",
\"checkpoint_status\" : \"transit\"
}]
},
\"destination_info\" : null,
\"lastEvent\" : \"快件已被 已签收 签收,广东湛江公司北月便民寄存点分部,2018-02-06 19:49:26\",
\"lastUpdateTime\" : \"2018-02-06 19:49:26\"
}]
}
}";
?>
点击下方图片前往:TrackMore官网
下载除html以外的其他部分:download_trackmore
JQ + PHP + TrackMore物流信息跟踪的更多相关文章
- 利用django打造自己的工作流平台(一):从EXCEL到流程化运作
因工作所需以及管理个人一些日常事项,自己基于django(一个基于python的web框架,详细介绍可查阅相关资料)开发了一个简易的工作流平台[平台地址].本文首先简要介绍工作流平台的设计思想及其在项 ...
- ecshop用户中心订单详情增加快递单物流信息查询显示的功能
1,themes\default\user_transaction.dwt 找到: <!--{if $action eq order_detail} --> 在下面一行加入: <st ...
- cookie的初识和运用(js和jq)
cookie是什么 cookie是浏览器提供的一种机制,它将document 对象的cookie属性提供给JavaScript.可以由JavaScript对其进行控制,而并不是JavaScript本身 ...
- 调用第三方物流公司API即时查询物流信息
主要是利用快递鸟提供的物流服务,通过对接快递鸟的API,调用即时查询接口,获取物流信息. 这里采用java语言,调用快递鸟的接口为例.步骤如下: 1.首先,得去快递鸟的官方网站注册一个账号并进行实名认 ...
- 个人永久性免费-Excel催化剂功能第97波-快递单号批量查询物流信息
电商时代,快递已进千万家,做电商零售行业的,快递信息的再挖掘,也显得更有意义,是数据精细化运营中必不可少的一环.一般站在系统的角度,数据用于业务流转的增删改查使用,而对于分析需求来说,这些业务系统里集 ...
- 物流跟踪 调用快递鸟API
概要:关于调用快递鸟API,我有几句话想说,有几行代码想写 业务需求:就是做做商城,卖卖东西.然后需要做个物流跟踪的功能 需要获取的信息大概就是这个样子 现在看这个快递怎么这么慢 如何实现? 直接调用 ...
- jq选择器基础
Jquery $代表选择器 使用jq必须要导入jq文件 <script src="http://libs.baidu.com/jquery/2.0.0/jquery.min.js&qu ...
- [异常特工]android常见bug跟踪
前言 对app的线上bug的收集(友盟.云捕等)有时会得到这样的异常堆栈信息:没有一行代码是有关自身程序代码的.这使得对bug的解决无从下手,根据经验,内存不足OOM,Dialog关闭,ListVie ...
- Entity Framework 6 Recipes 2nd Edition(9-4)译->Web API 的客户端实现修改跟踪
9-4. Web API 的客户端实现修改跟踪 问题 我们想通过客户端更新实体类,调用基于REST的Web API 服务实现把一个对象图的插入.删除和修改等数据库操作.此外, 我们想通过EF6的Cod ...
随机推荐
- VS2010 使用TeeChart绘图控件 - 之一 - 控件和类的导入
vs2010的用法和vc6有很大的不同,特别是在一些函数调用那里,当然.控件导入也是很不一样的 安装好控件后就可以在工程里加入teechart控件了 加入方法有如下几种: 1.添加Teechart控件 ...
- HDU4336:Card Collector
题意 有n张卡片,每一次 有pi的概率买到第i张卡.求买到所有卡的期望购买次数. n<=20 解析 Solution 1:大力状压(就是步数除以方案数) #include<iostream ...
- IJ-java-com-util-common:
ylbtech-IJ-java-com-util-common: 1.返回顶部 2.返回顶部 3.返回顶部 4.返回顶部 5.返回顶部 6.返回顶部 作者:ylbtech出 ...
- bzoj2648
http://www.lydsy.com/JudgeOnline/problem.php?id=2648 kdtree裸题... 抄板子一边抄对了... 挺好理解的,就是说我们先找出中间的元素,然后小 ...
- E20170925-hm
arc n. 综合症状; 弧(度); 天穹; 电弧,弧光.; vi. 形成拱状物; 循弧线行进; wrap vt. 包; 缠绕; 用…包裹(或包扎.覆盖等); 掩护; n. ...
- P3379最近公共祖先(LCA)
题目描述 如题,给定一棵有根多叉树,请求出指定两个点直接最近的公共祖先. 输入输出格式 输入格式: 第一行包含三个正整数N.M.S,分别表示树的结点个数.询问的个数和树根结点的序号. 接下来N-1行每 ...
- [Swift通天遁地]三、手势与图表-(1)监听屏幕上触摸事件的各种状态
★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★➤微信公众号:山青咏芝(shanqingyongzhi)➤博客园地址:山青咏芝(https://www.cnblogs. ...
- 接口管理功能全面增强!EOLINKER EPC 5.0.9版本更新:支持LDAP用户系统、加入更多项目统计图表、强化测试/自动化测试功能等
EOLINKER EPC(Enterprise Private Cloud 企业私有云产品)已于近期发布5.0.9版本:界面全面改版.支持LDAP用户系统.加入更多项目统计图表.强化测试/自动化测试功 ...
- sql 全站搜索
SQL全站搜索 create proc Full_Search(@string varchar(50)) as begin declare @tbname varchar(50) declare tb ...
- 题解报告:hihoCoder #1175:拓扑排序·二
题目链接:https://hihocoder.com/problemset/problem/1175 时间限制:10000ms 单点时限:1000ms 内存限制:256MB 描述 小Hi和小Ho所在学 ...