&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编码
///
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;
check = new System.Security.Cryptography.MD5CryptoServiceProvider();
byte[] somme = check.ComputeHash(buffer);
- 厦门网上房地产备案查询 厦门网上房地产 厦门2022拆迁表
- 快递单号查询自动查询申通 快递单号查询自动查询 快递100运单号查询
- 社保缴费记录查询在支付宝哪里查 社保缴费记录查询 12333社保缴费明细查询
- 智学网成绩查询入口在线登录 智学网成绩查询入口 个人成绩查询登录
- 快递查询单号查询邮政 快递查询单号查询 快递100查询单号
- 极兔速递属于什么快递公司 新闻 极兔速递属于什么快递公司
- 征信中心个人信用查询银行 征信中心个人信用查询 中国人行征信中心个人查询
- 鸽子快递到家怎么喂 鸽子快递到家怎么调理
- 裁判文书网官网查询判决书 裁判文书网官网 中国裁判文书公开网官网入口
- 极兔快递物流不显示 极兔快递物流不动是什么原因