the electronic surface is a kind of logistics service that print and output paper logistics form through thermal paper. The print speed is 4~6 times faster than the traditional needle printing speed by using the heat-sensing display text . Electronic form embedded in the form of the interface to their own systems, websites, you can operate on their own platform to print electronic form.
1. Interface Description
how the interface supports message reception: HttpPost
encoding format of the request method (Utf-8) :"Application/x-www-form-urlencoded;charset=utf-8"
API Address:http://api.kdniao.cc/Ebusiness/EbusinessOrderHandle.aspx
Interface offers: Express Bird
2. Request System-level parameters
Parameter name |
Type |
Description |
Must require |
RequestData |
String |
The request content needs to be URL (utf-8) encoded. Request content JSON format, must be consistent with datatype. |
R |
Ebusinessid |
String |
Merchant ID, please view it on the My Services page. |
R |
RequestType |
String |
Request Instruction Type: 1007 |
R |
Datasign |
String |
Data content Signature: The (Request content (not encoded) +appkey) is MD5 encrypted, then BASE64 encoded, and finally the URL (utf-8) encoding. Please check the demo for detailed procedures. |
R |
DataType |
String |
Request, return data type: Only JSON format is supported |
O |
remark: R- required (Required),O-selectable (Optional),C- message This parameter is selectable under certain conditions (Conditional)
3.PHP Docking Source
<?php/** * * Express Bird Electronic Surface Single interface * * @ technology qq: 4009633321 * @ QQ Group: 200121393 * @see: http://www.kdniao.com/miandanapi.aspx * @copyright: Shenzhen Fast Gold Data Technology Service Co., Ltd. * * id and key please apply to the official website: http://www.kdniao.com/serviceapply.aspx */// E-commerce iddefined (' Ebusinessid ') or define (' ebusinessid ', ' please apply to express Bird website http://www.kdniao.com/ Serviceapply.aspx ');//e-commerce encryption private key, courier Bird provided, pay attention to custody, do not leak defined (' AppKey ') or define (' AppKey ', ' Please go to the Express Bird website for http://www.kdniao.com/ServiceApply.aspx ');//Request URL, interface official address: http://api.kdniao.cc/api/ eorderservicedefined (' Requrl ') or define (' Requrl ', ' http://testapi.kdniao.cc:8081/api/ Eorderservice ');//call to get logistic trajectory//-------------------------------------------------------------//Construct electronic form submission information $eorder = []; $eorder ["Shippercode"] = "SF"; $eorder ["Ordercode"] = "PM201604062341"; $ eorder["PayType"] = 1; $eorder ["Exptype"] = 1; $sender = []; $sender ["Name"] = "Mr. Li"; $sender ["Mobile"] = "18888888888"; $sender ["Provincename"] = "Mr. Li", $sender ["CityName"] = "Shenzhen"; $sender ["Expareaname"] = "Futian District"; $sender ["Address"] = "Seg Plaza 5401AB", $receiver = []; $receiver ["Name"] = "Mr. Li"; $receiver ["Mobile"] = "18888888888", $receiver ["Provincename"] = "Mr. Li"; $receiver ["CityName"] = "Shenzhen" ; $receiver ["Expareaname"] = "Futian District"; $receiver ["Address"] = "seg Plaza 5401AB"; $commodityOne = []; $commodityOne ["Goodsname"] = "other"; $commodity = []; $commodity [] = $ Commodityone, $eorder ["Sender"] = $sender; $eorder ["Receiver"] = $receiver; $eorder [" Commodity "] = $commodity;//Call E-form $jsonparam = json_encode ($eorder, json_unescaped_ UNICODE);//$jsonParam = json ($eorder);//compatible with php5.2 (including) the following echo "Electronic surface Single interface submission:<br/>". $jsonParam; $ Jsonresult = submiteOrder ($jsonParam);echo "<br/><br/> e-form submission Results:<br/>". $jsonResult;//Parse the E-form to return the result $result = json_decode ($jsonResult, true);echo "<br/><br/> Return Code:". $result ["ResultCode"];if ($ result["ResultCode"] == "+") {echo "<br/> succeeded:". $result ["Success"];} else {echo "<br/> e-form failure";} -------------------------------------------------------------/** * json Way Inquiry Order logistics track */ Function submiteorder ($requestData) {$datas = array ( ' Ebusinessid ' => EBusinessID, ' RequestType ' => ' 1007 ', ' RequestData ' => UrlEncode ($requestData) , ' DataType ' => ' 2 ', ); $datas [' Datasign '] = encrypt ($requestData, AppKey); $result =sendpost (requrl, $datas);//......return $result of information returned according to the company's business;} /** * post submit data * @param string $url Request url * @param array $datas submitted data * @return url response returned by html */ Function sendpost ($url, $datas) { $temps = array (); foreach ($datas as $key => $value) { $temps [] = sprintf ('%s=%s ', $key, $value); } $post _data = implode (' & ', $temps); $ Url_info = parse_url ($url), if ($url _info[' Port ']== ') {$url _info[' port ']=80;} echo $url _info[' Port ']; $httpheader = "post " . $url _info [' Path '] . " http/1.0\r\n"; $httpheader.= "Host:" . $url _info[' host '] . "\ r \ n"; $httpheader .= " content-type:application/x-www-form-urlencoded\r\n "; $httpheader .= " Content-Length : " . strlen ($post _data) . " \ r \ n "; $httpheader .= " Connection: close\r\n\r\n "; $httpheader .= $post _data; $fd = Fsockopen ($url _info[' host '], $url _info[' Port '); fwrite ($fd, $httpheader); $gets = $headerFlag = true;while (!feof ($FD)) {if ($header = @fgets ($FD) && ($header == "\ r \ n" | | $header == "\ n")) {break;}} while (!feof ($FD)) {$gets. = fread ($FD, 128); } fclose ($FD); return $gets;} /** * sign Generation * @param data content * @param appkey appkey * @return datasign Signature */function encrypt ($data, $appkey) { return urlencode (Base64_encode (MD5 ($data. $appkey)));} /************************************************************** * * Use a specific function to handle all elements in an array * @param string & $array string to process * @param string $function functions to execute * @return boolean $apply _to_keys_also is also applied to the key * @access public * ************************* / function arrayrecursive (& $array, $function, $apply _TO_KEYS_ALSO&NBSP;=&NBSP;FALSE) { static $recursive _counter = 0; if (+ + $recursive _counter > 1000) { die (' Possible deep recursion attack '); } foreach ($array as $key => $value) { if (Is_array ($value)) { arrayrecursive ($array [$key ], $function, $apply _to_keys_also); } else { $array [$ key] = $function ($value); } if ($apply _to_keys_also && is_string ($key)) { $new _key = $ function ($key); if ($ new_key != $key) { $array [$new _key] = $array [$key]; unset ($array [$key]); } } } $recursive _ counter--; } /************************************************************** * * &nbSP; Convert an array to a JSON string (Chinese) * @param array $array arrays to convert * @return string Converted JSON string * @access public * ***************************** / function json ($array) { arrayrecursive ($array, ' UrlEncode ', true); $json = json_encode ($array); return urldecode ($json); } ?>
Circular powered sub-surface single interface application case (PHP)