欢迎来到天天文库
浏览记录
ID:6636009
大小:78.92 KB
页数:9页
时间:2018-01-20
《快递鸟智能物流查询api》由会员上传分享,免费在线阅读,更多相关内容在工程资料-天天文库。
1、快递鸟智能物流查询API接口名称:即时查询接口+单号识别接口编写语言:C#接口提供:快递鸟(以下标红问号代表接口ID和接口KEY,登录账号后查询)即时查询接口demousingSystem;usingSystem.Collections.Generic;usingSystem.Linq;usingSystem.Text;usingSystem.Web;usingSystem.Net;usingSystem.IO;namespaceKdGoldAPI{publicclassKdApiSearchDemo{//电商IDprivates
2、tringEBusinessID="??????";//电商加密私钥,注意保管,不要泄漏privatestringAppKey="??????";//请求urlprivatestringReqURL="http://api.kdniao.cc/Ebusiness/EbusinessOrderHandle.aspx";//////Json方式查询订单物流轨迹//////publicstringgetOrderTracesByJson(){stringrequ
3、estData="{'OrderCode':'','ShipperCode':'SF','LogisticCode':'7'}";Dictionaryparam=newDictionary();param.Add("RequestData",HttpUtility.UrlEncode(requestData,Encoding.UTF8));param.Add("EBusinessID",EBusinessID);param.Add("RequestType","1002"
4、);stringdataSign=encrypt(requestData,AppKey,"UTF-8");param.Add("DataSign",HttpUtility.UrlEncode(dataSign,Encoding.UTF8));param.Add("DataType","2");stringresult=sendPost(ReqURL,param);//根据公司业务处理返回的信息......returnresult;}//////Post方式提交数据,返回网页的源代码//////
5、发送请求的URL///请求的参数集合///远程资源的响应结果privatestringsendPost(stringurl,Dictionaryparam){stringresult="";StringBuilderpostData=newStringBuilder();if(param!=null&¶m.Count>0){foreach(varpinp
6、aram){if(postData.Length>0){postData.Append("&");}postData.Append(p.Key);postData.Append("=");postData.Append(p.Value);}}byte[]byteData=Encoding.GetEncoding("UTF-8").GetBytes(postData.ToString());try{HttpWebRequestrequest=(HttpWebRequest)WebRequest.Create(url);request
7、.ContentType="application/x-www-form-urlencoded";request.Referer=url;request.Accept="*/*";request.Timeout=30*1000;request.UserAgent="Mozilla/4.0(compatible;MSIE6.0;WindowsNT5.1;SV1;.NETCLR2.0.50727;.NETCLR3.0.04506.648;.NETCLR 3.0.4506.2152;.NETCLR3.5.30729)";request.
8、Method="POST";request.ContentLength=byteData.Length;Streamstream=request.GetRequestStream();stream.Write(byteData,0,byteData
此文档下载收益归作者所有