圆通快递查询单号查询电话号码查询 圆通快递查询单号 输入手机号码查询快递( 二 )


&34;PayType&34;: 1,
&34;MonthCode&34;: &34;1234567890&34;,
&34;ExpType&34;: 1,
&34;Sender&34;: {
&34;Company&34;: &34;LV&34;,
&34;Name&34;: &34;Taylor&34;,
&34;Mobile&34;: &34;15018442396&34;,
&34;ProvinceName&34;: &34;上海&34;,
&34;CityName&34;: &34;上海市&34;,
&34;ExpAreaName&34;: &34;青浦区&34;,
&34;Address&34;: &34;明珠路&34;
},
&34;Receiver&34;: {
&34;Company&34;: &34;GCCUI&34;,
&34;Name&34;: &34;Yann&34;,
&34;Mobile&34;: &34;15018442396&34;,
&34;ProvinceName&34;: &34;北京&34;,
&34;CityName&34;: &34;北京市&34;,
&34;ExpAreaName&34;: &34;朝阳区&34;,
&34;Address&34;: &34;三里屯街道&34;
},
&34;Commodity&34;: [{
&34;GoodsName&34;: &34;鞋子&34;,
&34;Goodsquantity&34;: 1,
&34;GoodsWeight&34;: 1
}],
&34;Weight&34;: 1,
&34;Quantity&34;: 1,
&34;Volume&34;: 0,
&34;Remark&34;: &34;小心轻放&34;
}
C关键代码:
///
/// 即时查询物流轨迹
///
/// http://sandboxapi.kdniao.com:8080/kdniaosandbox/gateway/exterfaceInvoke.json
/// test1617571
/// 554343b2-7252-439b-b4eb-1af42c8f2175
/// {&39;OrderCode&39;:&39;&39;,&39;ShipperCode&39;:&39;ZTO&39;,&39;LogisticCode&39;:&39;78120038107849&39;}
///
public string getOrderTracesByJson(string url,string eBusinessID, string appKey, string requestData)
{
Dictionary param = new Dictionary();
param.Add(&34;RequestData&34;, HttpUtility.UrlEncode(requestData, Encoding.UTF8));
param.Add(&34;EBusinessID&34;, eBusinessID);
param.Add(&34;RequestType&34;, &34;1002&34;);
string dataSign = encrypt(requestData, appKey, &34;UTF-8&34;);
param.Add(&34;DataSign&34;, HttpUtility.UrlEncode(dataSign, Encoding.UTF8));
param.Add(&34;DataType&34;, &34;2&34;);
string result = sendPost(url, param);
return result;
}
///
/// Post方式提交数据,返回网页的源代码
【圆通快递查询单号查询电话号码查询 圆通快递查询单号 输入手机号码查询快递】 ///
/// 发送请求的 URL
/// 请求的参数集合
/// 远程资源的响应结果
private string sendPost(string url, Dictionary param)
{
string result = &34;&34;;
StringBuilder postData = https://www.yebaike.net/info/new StringBuilder();
if (param != null && param.Count > 0)
{
foreach (var p in param)
{
if (postData.Length > 0)
{
postData.Append(&34;&&34;);
}
postData.Append(p.Key);
postData.Append(&34;=&34;);
postData.Append(p.Value);
}
}
// return postData.ToString();
byte[] byteData = https://www.yebaike.net/info/Encoding.GetEncoding(&34;UTF-8&34;).GetBytes(postData.ToString());
try
{
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url);
request.ContentType = &34;application/x-www-form-urlencoded&34;;
request.Referer = url;
request.Accept = &34;*/*&34;;
request.Timeout = 30 * 1000;
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;;
request.Method = &34;POST&34;;
request.ContentLength = byteData.Length;
Stream stream = request.GetRequestStream();
stream.Write(byteData, 0, byteData.Length);
stream.Flush();
stream.Close();
HttpWebResponse response = (HttpWebResponse)request.GetResponse();
Stream backStream = response.GetResponseStream();
StreamReader sr = new StreamReader(backStream, Encoding.GetEncoding(&34;UTF-8&34;));
result = sr.ReadToEnd();
sr.Close();
backStream.Close();
response.Close();
request.Abort();
}
catch (Exception ex)
{
result = ex.Message;
}
return result;
}
///
///电商Sign签名
///
///内容
///Appkey
///URL编码
///DataSign签名
private string encrypt(String content, String keyValue, String charset)
{
if (keyValue != null)
{
return base64(MD5(content + keyValue, charset), charset);
}
return base64(MD5(content, charset), charset);
}
///
/// 字符串MD5加密
///
///要加密的字符串
///编码方式
///密文
private string MD5(string str, string charset)
{
byte[] buffer = System.Text.Encoding.GetEncoding(charset).GetBytes(str);
try
{
System.Security.Cryptography.MD5CryptoServiceProvider check;