This article mainly introduces the PHP call Express Bird Interface Instance code, the need for friends can refer to the following
The code is as follows:
<?php//e-commerce iddefined (' Ebusinessid ') or define (' Ebusinessid ', ' e-commerce id ');//e-commerce encryption private key, courier Bird provided, pay attention to custody, do not leak defined (' AppKey ') or Define (' AppKey ', ' e-commerce encrypted private key ');//Request urldefined (' Requrl ') or define (' Requrl ', ' http://api.kdniao.cc/Ebusiness/ Ebusinessorderhandle.aspx ');//Call Query Logistics track//---------------------------------------------$kgs = "STO";//Express company abbreviation, official documents $number = "3335800028275";//Express ticket//$logisticResult = Getordertracesbyjson ($kgs, $number); $data = Json_decode ($ Logisticresult,true) if ($data [' Success '] = = true) {//return information success $STR = ""; for ($i =0; $i <count ($data [' traces ']); $i + +) {$ str. = "Time:". $data [' Traces '] [$i] [' accepttime ']. " <br/> address: ". $data [' Traces '] [$i] [' acceptstation ']." <br/> ";} echo "The ticket number you are inquiring for is:". $data [' Logisticcode ']. " <br/> Logistics Information:<br/> ". $str.";} ---------------------------------------------/** * JSON way to Query Order logistics track * $kgs String Express Company * $number String Express number */function ge Tordertracesbyjson ($kgs, $number) {$requestData = ' {' Ordercode ': ', ' shippercode ': ' $kgs ', ' logisticcode ': ' $number '} ' ; $datas = Array (' EBUsinessid ' + ebusinessid, ' requesttype ' = ' 1002 ', ' RequestData ' + urlencode ($requestData), ' DataType ' = ' 2 ',); $datas [' datasign '] = Encrypt ($requestData, AppKey), $result =sendpost (Requrl, $datas);//information returned according to the company's business ... return $ Result;} /** * Post Submission 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 (Empty ($url _info[' Port ')) {$url _info[' port ']=80;} $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;} /** * e-commerce sign Signature generated * @param data content * @param appkey appkey * @return datasign signature */function Encrypt ($data, $appkey) {Retu RN UrlEncode (Base64_encode (MD5 ($data. $appkey))); >
PHP Call Express Bird Interface
Courier Company code:
Coding |
Name |
Aj |
Express |
ANE |
Safety and Energy Logistics |
AXD |
Ann Xinda Express |
Bqxhm |
North Green Little Red Riding Hood |
Bfdf |
Pak Fu Orient |
Btwl |
Fast Luck |
CCES |
CCEs Express |
CITY100 |
City 100 |
Coe |
Coe Orient Express |
Cscy |
Changsha Chuang Yi |
Cdstky |
Chengdu Good Way Fast transport |
DBL |
Darbond |
Dswl |
D-Speed Logistics |
Dtwl |
Daejeon Logistics |
Ems |
Ems |
FAST |
Fast Courier |
FEDEX |
FedEx Federal (domestic parts) |
Fedex_gj |
FedEx Federal (International) |
FKD |
Fei Kang da |
Gdems |
Guangdong Post |
GSD |
Total speed up to |
Gto |
Guo Tong Express |
Gtsd |
High Speed Express |
Hfwl |
HSBC Logistics |
Hhtt |
Daily Express |
Hlwl |
Heng Lu Logistics |
Hoau |
Tian Hua Yu |
hq568 |
China Strong Logistics |
Htky |
Express |
Hxlwl |
Huaxia Dragon Logistics |
Hylsd |
All right, delivery. |
Jgsd |
BEIJING-Guangzhou Express |
Jiuye |
Nine-Traction supply chain |
Jjky |
Jia Ji Express |
Jldt |
Kerry Logistics |
Jtkd |
Czech Express |
Jxd |
Quick |
Jykd |
Jin Yue Express |
Jym |
Kanumi |
Jywl |
Jia Yi Logistics |
Kywl |
Cross-Logistics |
Lb |
Longbang Express |
LHT |
Union Hao Tong Express |
Mhkd |
Civil Aviation Express |
Mlwl |
Bright Logistics |
NEDA |
Can reach courier |
Padtf |
Ping An da Fei Express |
Qckd |
All Morning Express |
Qfkd |
Full Peak Express |
QRT |
Full-day Pass Express |
RFD |
such as wind up |
SAD |
Sai o Pass |
Sawl |
Sant ' Agnello Logistics |
Sbwl |
Surbana Logistics |
Sdwl |
On the Big logistics |
SF |
Shun Fung Express |
Sfwl |
Shengfeng Logistics |
Shwl |
Shenghui Logistics |
St |
Fast-pass Logistics |
Sto |
Shentong Express |
Stwl |
Quick Express |
Sure |
Quick Courier |
Tssto |
Tangshan Shentong |
Uapex |
All One Express |
Uc |
Speed Express |
Wjwl |
Million Home logistics |
Wxwl |
Vientiane Logistics |
Xbwl |
New State Logistics |
Xfex |
Xinfeng Express |
Xyt |
Nozomi |
Xj |
New Jay Logistics |
Yadex |
SOURCE Anda Express |
Ycwl |
Far into the logistics |
Yd |
Yun da Express |
Ydh |
Yida International Logistics |
Yfex |
Yue Feng Logistics |
Yfhex |
Original Aviation Logistics |
Yfsd |
Asia Wind Express |
Ytkd |
Express Express |
Yto |
Yuantong Express |
Yxkd |
Yi Xiang Express |
Yzpy |
Postal mail/Parcel |
Zeny |
Gain Express |
Zhqkd |
Hui Qiang Express |
ZJS |
Home Emergency Delivery |
ZTE |
Zhong Tong Express |
Ztky |
Chinese Railway Express |
Zto |
In-Pass Express |
Ztwl |
Chinese Railway Logistics |
Zywl |
Chinese Postal Logistics |
AMAZON |
Amazon Logistics |
Subida |
Speed must reach logistics |
Rfex |
Rui Feng Express |
QUICK |
Express Customer Service |
Cjkd |
Inter-City Express |
Cnpex |
Cnpex in the Mail Express |
Hotscm |
Hong Qiao Supply Chain |
Hptex |
Shanghai Tong Logistics Co., ltd |
Ayca |
Australian postal Line |
Panex |
Pan-Jie Express |
Pca |
PCA Express |
Ueq |
Ueq Express |
Related recommendations:
PHP implementation Love Check Express Interface _php Tutorial
PHP Redemption Love Check Express interface
PHP Implementation Love Check Express interface