查快递--快递100 抓包

using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading;
using System.Windows.Forms;

namespace ExpressCheck
{
public partial class Form1 : Form
{
private SynchronizationContext Context;
public Form1()
{
InitializeComponent();
Context = SynchronizationContext.Current;

}

private void button1_Click(object sender, EventArgs e)
{
new System.Threading.Thread(QueryExpress).Start(textBox1.Text);
}

private void QueryExpress(object obj)
{
try
{
HttpCodeLib.Wininet w = new HttpCodeLib.Wininet();
string retCode = w.GetData(string.Format("http://www.kuaidi100.com/autonumber/auto?num={0}", obj));
List<ExpressType> typeList = JsonConvert.DeserializeObject<List<ExpressType>>(retCode);
ExpressInfo info;
foreach (ExpressType item in typeList)
{
retCode = w.GetUtf8(string.Format("http://www.kuaidi100.com/query?type={0}&postid={1}", item.ComCode, obj));
info = JsonConvert.DeserializeObject<ExpressInfo>(retCode);
if (info != null && info.Status == "200")
{
OnLog("当前订单查询成功:");
foreach (Datum tmp in info.Data)
{
OnLog("【" + tmp.Time + "】 " + tmp.Context);
}
break;
}
}
}
catch (Exception ex)
{
OnLog(ex.Message);
}
}

private void OnLog(string log)
{
Context.Send(o =>
{
textBox2.Text += log + "\r\n";
}, null);
}
}

public class ExpressType
{
[JsonProperty("comCode")]
public string ComCode { get; set; }

[JsonProperty("id")]
public string Id { get; set; }

[JsonProperty("noCount")]
public int NoCount { get; set; }

[JsonProperty("noPre")]
public string NoPre { get; set; }

[JsonProperty("startTime")]
public string StartTime { get; set; }
}

public class ExpressInfo
{
[JsonProperty("nu")]
public string Nu { get; set; }

[JsonProperty("message")]
public string Message { get; set; }

[JsonProperty("ischeck")]
public string Ischeck { get; set; }

[JsonProperty("com")]
public string Com { get; set; }

[JsonProperty("updatetime")]
public string Updatetime { get; set; }

[JsonProperty("status")]
public string Status { get; set; }

[JsonProperty("condition")]
public string Condition { get; set; }

[JsonProperty("data")]
public Datum[] Data { get; set; }

[JsonProperty("state")]
public string State { get; set; }
}

public class Datum
{
[JsonProperty("time")]
public string Time { get; set; }

[JsonProperty("context")]
public string Context { get; set; }

[JsonProperty("ftime")]
public string Ftime { get; set; }
}
}

转载于:https://www.cnblogs.com/qizhuocai/p/6118547.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值