登陆注册
1947

申通快递查询单号(订单号查询)

大财经2023-03-20 20:43:370

return base64(MD5(content, charset), charset);

&34;AcceptTime&34;: &34;2020-01-11 08:06:34&34;

&34;Traces&34;: [

未编码的请求报文:

}

return result;

{

sr.Close();

{

&34;AcceptTime&34;: &34;2020-01-09 15:28:36&34;

&34;AcceptTime&34;: &34;2020-01-09 20:16:29&34;

return Convert.ToBase64String(System.Text.Encoding.GetEncoding(charset).GetBytes(str));

///<param name=&34;str&34;>要加密的字符串</param>

&34;AcceptTime&34;: &34;2020-01-11 00:49:01&34;

&34;AcceptStation&34;: &34;快件已由【广东深圳转运中心】扫描发往【广东罗湖龙华横林分部】,扫描员【深圳进港自动化中心】。由于疫情防控和交通管制的影响,您的快件时效可能会受到影响,请您耐心等待,感谢理解&34;,

},

request.UserAgent = &34;Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 2.0.50727; .NET CLR 3.0.04506.648; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729)&34;;

}

},

},

param.Add(&34;DataType&34;, &34;2&34;);

请求的完整报文(URL编码以后):

/// <summary>

}

param.Add(&34;RequestType&34;, &34;1002&34;);

&34;AcceptStation&34;: &34;已签收,收件人凭客户短信取件签收&34;,

response.Close();

byte[] somme = check.ComputeHash(buffer);

// return postData.ToString();

&34;AcceptTime&34;: &34;2020-01-11 00:48:31&34;

&34;AcceptTime&34;: &34;2020-01-09 17:59:53&34;

{

{&39;OrderCode&39;:&39;&39;,&39;ShipperCode&39;:&39;STO&39;,&39;LogisticCode&39;:&39;777007389359024&39;}

string result = &34;&34;;

&34;AcceptStation&34;: &34;已到达-广东深圳转运中心&34;,

&34;AcceptStation&34;: &34;疫情无情,人有情,申通小哥一直在坚守。您的快件即将由(广东罗湖龙华横林分部)的派件员(王忠明)送达,为确保广大客户寄递安全,减少人员直接接触,我们建议您在取件时做好安全防护&34;,

/// <returns></returns>

/// <param name=&34;requestData&34;>{&39;OrderCode&39;:&39;&39;,&39;ShipperCode&39;:&39;ZTO&39;,&39;LogisticCode&39;:&39;78120038107849&39;}</param>

&34;LogisticCode&34;: &34;777007389359024&34;,

StringBuilder postData = new StringBuilder();

{

private string encrypt(String content, String keyValue, String charset)

private string sendPost(string url, Dictionary<string, string> param)

}

param.Add(&34;DataSign&34;, HttpUtility.UrlEncode(dataSign, Encoding.UTF8));

&34;AcceptTime&34;: &34;2020-01-08 19:45:01&34;

public string getOrderTracesByJson(string url,string eBusinessID, string appKey, string requestData)

postData.Append(&34;&&34;);

/// <param name=&34;url&34;>http://sandboxapi.kdniao.com:8080/kdniaosandbox/gateway/exterfaceInvoke.json</param>

///<summary>

{

今天我们来聊如何利用快递鸟提供的接口来查询【申通快递】的物流轨迹。

{

postData.Append(p.Key);

},

{

{

if (postData.Length > 0)

/// <param name=&34;param&34;>请求的参数集合</param>

string result = sendPost(url, param);

{

&EBusinessID=1617571&RequestType=1002&DataSign=N2I4ZGEzYjkwMzhkZWY0YmM5ZGYxOGNkYjU5MmI2ZTU=&DataType=2

check = new System.Security.Cryptography.MD5CryptoServiceProvider();

string dataSign = encrypt(requestData, appKey, &34;UTF-8&34;);

/// <returns>远程资源的响应结果</returns>

/// Post方式提交数据,返回网页的源代码

catch

///<param name=&34;content&34;>内容</param>

/// base64编码

{

}

/// 字符串MD5加密

},

{

&34;Success&34;: true

///<param name=&34;keyValue&34;>Appkey</param>

}

}

/// </summary>

}

postData.Append(&34;=&34;);

554343b2-7252-439b-b4eb-1af42c8f2175(此Key仅限测试环境使用)

&34;AcceptTime&34;: &34;2020-01-10 02:30:14&34;

///</summary>

&34;AcceptStation&34;: &34;已到达-江苏盐城中转部&34;,

/// 即时查询物流轨迹

param.Add(&34;RequestData&34;, HttpUtility.UrlEncode(requestData, Encoding.UTF8));

{

&34;AcceptStation&34;: &34;已到达-江苏江阴航空部&34;,

if (a < 16)

http://sandboxapi.kdniao.com:8080/kdniaosandbox/gateway/exterfaceInvoke.json

&34;AcceptStation&34;: &34;已到达-广东罗湖龙华横林分部&34;,

&34;ShipperCode&34;: &34;STO&34;,

},

request.Timeout = 30 * 1000;

if (keyValue != null)

postData.Append(p.Value);

return base64(MD5(content + keyValue, charset), charset);

/// </summary>

{

{

},

///电商Sign签名

http://www.kdniao.com/origin/documents

return result;

{

{

/// <summary>

{

业务参数报文组合如下:

正如我前面的轨迹截图,申通快递的编码是STO,物流单号是777007389359024

private string MD5(string str, string charset)

},

ret += a.ToString(&34;X&34;);

try

如果还没有注册快递鸟,或者还不知道如何获取API Key,可以访问这个腾讯视频教程:

&34;AcceptTime&34;: &34;2020-01-10 02:28:24&34;

throw;

{

else

Stream stream = request.GetRequestStream();

}

&34;EBusinessID&34;: &34;1617571&34;,

///<param name=&34;charset&34;>编码方式</param>

try

测试API key:

&34;AcceptTime&34;: &34;2020-01-11 11:18:36&34;

&34;AcceptStation&34;: &34;快件已由【江苏射阳公司】扫描发往【江苏盐城中转部】,扫描员【射阳】。由于疫情防控和交通管制的影响,您的快件时效可能会受到影响,请您耐心等待,感谢理解&34;,

{

&34;AcceptStation&34;: &34;已到达-广东罗湖龙华横林分部&34;,

&34;AcceptStation&34;: &34;快递已被【丰巢智能柜】深圳市龙华区鑫茂花园A区2栋1单元地下车库负1层门口丰巢快递柜代收,请及时取件。有问题请联系13925214311&34;,

RequestData=

&34;AcceptTime&34;: &34;2020-01-11 00:48:28&34;

string ret = &34;&34;;

{

request.Accept = &34;*/*&34;;

{

},

///</summary>

{

/// </summary>

request.ContentType = &34;application/x-www-form-urlencoded&34;;

{

我以C开发为例来讲解,

}

/// <param name=&34;charset&34;>编码方式</param>

stream.Flush();

&34;State&34;: &34;3&34;,

&34;AcceptStation&34;: &34;快件已由【广东深圳转运中心】扫描发往【广东罗湖龙华横林分部】,扫描员【深圳进港自动化中心】。由于疫情防控和交通管制的影响,您的快件时效可能会受到影响,请您耐心等待,感谢理解&34;,

{

/// <param name=&34;str&34;>内容</param>

request.Abort();

&34;AcceptTime&34;: &34;2020-01-09 19:57:22&34;

API测试地址:

},

result = sr.ReadToEnd();

Stream backStream = response.GetResponseStream();

&34;AcceptTime&34;: &34;2020-01-11 12:55:57&34;

backStream.Close();

///<returns>密文</returns>

],

return ret.ToLower();

}

byte[] byteData = Encoding.GetEncoding(&34;UTF-8&34;).GetBytes(postData.ToString());

},

HttpWebResponse response = (HttpWebResponse)request.GetResponse();

}

request.Method = &34;POST&34;;

///<returns>DataSign签名</returns>

///<param name=&34;charset&34;>URL编码 </param>

http://v.qq.com/origin/x/page/z3068yfw0fl.html(注册登陆获取快递鸟API Key)接下来,我们讲解一下请求参数

foreach (var p in param)

///<summary>

request.Referer = url;

/// <summary>

private string base64(String str, String charset)

返回的报文信息:

foreach (byte a in somme)

if (param != null && param.Count > 0)

/// <returns></returns>

&34;AcceptTime&34;: &34;2020-01-11 10:33:36&34;

}

{

{&39;OrderCode&39;:&39;&39;,&39;ShipperCode&39;:&39;STO&39;,&39;LogisticCode&39;:&39;777007389359024&39;}

首先我们准备好需要用到的资源,

},

/// <param name=&34;appKey&34;>554343b2-7252-439b-b4eb-1af42c8f2175</param>

如要查看其他快递公司的编码,点击此链接:

RequestData=%0d%0a++++++++++++%7b%27OrderCode%27%3a%27%27%2c%27ShipperCode%27%3a%27STO%27%2c%27LogisticCode%27%3a%27777007389359024%27%7d%0d%0a++++++++&EBusinessID=1617571&RequestType=1002&DataSign=N2I4ZGEzYjkwMzhkZWY0YmM5ZGYxOGNkYjU5MmI2ZTU%3d&DataType=2

&34;AcceptStation&34;: &34;快件已由【江苏盐城中转部】扫描发往【江苏江阴航空部】,扫描员【陈建群】。由于疫情防控和交通管制的影响,您的快件时效可能会受到影响,请您耐心等待,感谢理解&34;,

},

&34;AcceptTime&34;: &34;2020-01-11 22:18:09&34;

test1617571

{

},

catch (Exception ex)

param.Add(&34;EBusinessID&34;, eBusinessID);

request.ContentLength = byteData.Length;

byte[] buffer = System.Text.Encoding.GetEncoding(charset).GetBytes(str);

{

测试商户ID:

System.Security.Cryptography.MD5CryptoServiceProvider check;

&34;AcceptStation&34;: &34;您的宝贝即将由申通快递(江苏省市场部三十七部)全程护航,揽件员(宏峰路)。由于疫情防控和交通管制的影响,您的快件时效可能会受到影响,希望能得到您的理解,详情可咨询当地网点&34;,

}

}

StreamReader sr = new StreamReader(backStream, Encoding.GetEncoding(&34;UTF-8&34;));

stream.Write(byteData, 0, byteData.Length);

{

接口参数,也叫业务参数,请求的业务接口不同,参数的字段,内容也不同,是跟着业务变化的,这里我们实现的是即时查询接口,请求指令类型:1002,快递鸟官网要求必须传递快递公司编码和物流单号 ,圆通快递的编码是YTO

/// <param name=&34;eBusinessID&34;>test1617571</param>

stream.Close();

ret += &34;0&34; + a.ToString(&34;X&34;);

&34;AcceptStation&34;: &34;快件已由【江苏江阴航空部】扫描发往【广东深圳转运中心】,扫描员【张华臣】。由于疫情防控和交通管制的影响,您的快件时效可能会受到影响,请您耐心等待,感谢理解&34;,

/// <param name=&34;url&34;>发送请求的 URL</param>

result = ex.Message;

{

Dictionary<string, string> param = new Dictionary<string, string>();

}C关键代码:

&34;AcceptStation&34;: &34;快件已由【江苏射阳公司】扫描发往【江苏盐城中转部】,扫描员【孙霞】。由于疫情防控和交通管制的影响,您的快件时效可能会受到影响,请您耐心等待,感谢理解&34;,

{

HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url);

0000
评论列表
共(0)条
热点
关注
推荐