The source code has been tested by myself. There is no problem. You can query the express waybill number. Many supported express parcels are supported. yuantong Express, Shentong express, and yunda express support ticket number query, the program transmits parameters to the aiexpress (www.aikuaidi.cn) interface to query the Express bill number. I directly post the code to solve the problem of single development.
/// <Summary> /// Method for querying the synchronization ticket number /// </summary> /// <typeparam name = "T"> </typeparam> /// <param name = "id"> </param> // <param name = "order"> </param> // <param name = "isSign"> </param> /// <param name = "isLast"> </param> /// <param name = "defaultValue"> </param> /// <returns> </returns> public static T APIQueryDataSYNC <T> (string id, string order, bool isSign, bool isLast, T defaultValue) {try {string currTime = DateTime. now. toString ("yyyy-MM-dd HH: mm: ss"); string currKey = key; if (isSign) {currKey = Utils. getSign (uid, key, id, order, currTime); currKey + = "& issign = true" ;}string url = sync_url + string. format ("? Uid = {0} & key = {1} & id = {2} & order = {3} & time = {4} ", uid, currKey, id, order, httpUtility. urlEncode (currTime); string html = Utils. GET_WebRequestHTML ("UTF-8", url); if (! String. isNullOrEmpty (html) return Utils. jsonToObj <T> (html, defaultValue);} catch (Exception ex) {throw new Exception (ex. message) ;}return defaultValue ;}/// <summary> /// auxiliary tool class /// </summary> public class Utils {public static string GetSign (int uid, string key, string id, string order, string time) {string sign = string. format ("uid = {0} & key = {1} & id = {2} & order = {3} & time = {4}", uid, key, id, httpUtility. urlEncode (order. toLower (), HttpUtility. urlEncode (time); return Md5Encrypt (sign. toLower (), "UTF-8");} public static string Md5Encrypt (string strToBeEncrypt, string encodingName) {MD5 md5 = new MD5CryptoServiceProvider (); Byte [] FromData = System. text. encoding. getEncoding (encodingName ). getBytes (strToBeEncrypt); Byte [] TargetData = md5.ComputeHash (FromData); string Byte2String = ""; for (int I = 0; I <TargetData. length; I ++) {Byte2String + = TargetData [I]. toString ("x2");} return Byte2String;} public static T GetRequest <T> (string key, T defaultValue) {string value = HttpContext. current. request [key]; if (string. isNullOrEmpty (value) {return defaultValue;} else {try {return (T) Convert. changeType (value, typeof (T);} catch {return defaultValue ;}} public static T GetAppConfig <T> (string key, T defaultValue) {string value = ConfigurationManager. appSettings [key]; if (string. isNullOrEmpty (value) {return defaultValue;} else {try {return (T) Convert. changeType (value, typeof (T);} catch {return defaultValue ;}} public static string ObjToJson <T> (T data) {try {DataContractJsonSerializer serializer = new DataContractJsonSerializer (data. getType (); using (MemoryStream MS = new MemoryStream () {serializer. writeObject (MS, data); return Encoding. UTF8.GetString (ms. toArray () ;}} catch {return null ;}} public static T JsonToObj <T> (string json, T defaultValue) {try {System. runtime. serialization. json. dataContractJsonSerializer serializer = new System. runtime. serialization. json. dataContractJsonSerializer (typeof (T); using (MemoryStream MS = new MemoryStream (Encoding. UTF8.GetBytes (json) {object obj = serializer. readObject (MS); return (T) Convert. changeType (obj, typeof (T) ;}} catch {return defaultValue ;}} public static T XmlToObj <T> (string xml, T defaultValue) {try {System. runtime. serialization. dataContractSerializer serializer = new System. runtime. serialization. dataContractSerializer (typeof (T); using (MemoryStream MS = new MemoryStream (Encoding. UTF8.GetBytes (xml) {object obj = serializer. readObject (MS); return (T) Convert. changeType (obj, typeof (T) ;}} catch {return defaultValue ;}} public static string ObjToXml <T> (T data) {System. runtime. serialization. dataContractSerializer serializer = new System. runtime. serialization. dataContractSerializer (typeof (T); using (MemoryStream MS = new MemoryStream () {serializer. writeObject (MS, data); return Encoding. UTF8.GetString (ms. toArray () ;}} public static string GET_WebRequestHTML (string encodingName, string htmlUrl) {string html = string. empty; try {Encoding encoding = Encoding. getEncoding (encodingName); WebRequest webRequest = WebRequest. create (htmlUrl); HttpWebResponse httpWebResponse = (HttpWebResponse) webRequest. getResponse (); Stream responseStream = httpWebResponse. getResponseStream (); StreamReader streamReader = new StreamReader (responseStream, encoding); html = streamReader. readToEnd (); httpWebResponse. close (); responseStream. close (); streamReader. close ();} catch (WebException ex) {throw new Exception (ex. message) ;}return html ;}}