zoukankan      html  css  js  c++  java
  • 查快递--快递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 + " ";
    }, 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; }
    }
    }

  • 相关阅读:
    TCP/IP——何时用UDP代替TCP
    网络编程——客户/服务器程序设计范式
    各种常见英特网应用协议的使用情况和传输层三大协议的异同
    linux dd使用记录
    杂谈-为什么我们不要去外包公司
    小雪的成都
    哪个的情感
    mac上的git completion
    ue4 UE4Editor.lib找不到
    ue4 重新生成ide project文件的命令行
  • 原文地址:https://www.cnblogs.com/qizhuocai/p/6118547.html
Copyright © 2011-2022 走看看