Query the source code of the express waybill number in VB

Source: Internet
Author: User

Query the number of major express parcels, including Shentong express, yuantong Express, and yunda express among more than 90 domestic express waybills,

If you want to quickly set up a courier bill number query site, I recommend this. This is the address www.aikuaidi.cn. I will share a VB

Function kdcx (kd, orderid) Dim Err, url, kdtime, link, Errcode, StatusSelect Case kd 'many express delivery companies are supported here, which I usually use. Case "Shen Tong" kd = "shentong" Case "yuantong" kd = "yuantong" Case "" kd = "yousu" Case "long bang" kd = "longbang" Case "city" kd = "cs" Case Else MsgBox "does not support this express currently, you can contact the Administrator to add it! "Kdcx =" this express delivery is not supported now "Exit FunctionEnd SelectSet http = CreateObject (" Microsoft. XMLHTTP ") url =" http://www.aikuaidi.cn/rest/?key=29fe1030ceaa49ea8d0d7698efd1fd05&order= "& Orderid &" & id = "& kd &" & ord = desc & show = xml "http. open "get", url, Falsehttp. sendWebContent = http. responsetext 'msgbox WebContentSet objDom = CreateObject ("Microsoft. XMLDom ") objDom. async = FalseobjDom. loadXML (WebContent) If objDom. readyState> 2 Then Set Item = objDom. getElementsByTagName ("SyncResponseEntity") 'reads the specified region on the page For I = 0 To (Item. length-1) Status = Item. item (I ). getElementsByTagName (" Status "). item (0 ). text If Status = 1 Then kdcx = Status Exit For End If Errcode = Item. item (I ). getElementsByTagName ("errcode "). item (0 ). text 'dtime = Item. item (I ). getElementsByTagName ("time "). item (0 ). text 'link = Item. item (I ). getElementsByTagName ("content "). item (0 ). text NextElse MsgBox "data query is not ready yet. Status: "& objDom. ReadyState &". "End IfSet http = NothingSet objDom = NothingSelect Case Errcode Case" 0000 "Err =" no error "Case" 0001 "Err =" Incorrect transmission parameter format "Case" 0002 "Err =" user ID (uid) invalid "Case" 0003 "Err =" user disabled "Case" 0004 "Err =" Authorization key invalid "Case" 0005 "Err =" Courier Code (id) invalid "Case" 0006 "Err =" maximum access limit reached "Case" 0007 "Err =" query server return error "Case Else Err =" unknown query error "End SelectSelect Case status Case "-1" Status = "unupdated Ticket No." Case "0" Status = "query exception" Case "1" Status = "no record" Case "2" Status = "on the way" Case "3" Status = "dispatching" Case "4" Status = "accepted" Case "5" Status = "REJECTED" Case "6" Status = "Troubleshooting" Case "7" Status = "invalid ticket" Case "8" Status = "timeout ticket" Case "9" Status = "failed to sign" Case Else Status =" unknown express status "End Selectkdcx = StatusEnd Function

  

The source code of the version is provided to you. You can use it directly by calling methods!

 

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.