联系客服: iP138.com客服 iP138客服 |

ASP调用快递查询接口示例:

方法一

                                        <%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
                                        <% Option Explicit
                                        '=========================================================
                                        ' File      : .asp
                                        ' Version   : 1.0.0.0
                                        ' Create    : 
                                        ' Modify    : 
                                        '=========================================================
                                        ' 1.0.0.0   : 
                                        '========================================================= %>
                                        <% Dim no,token,url

                                        no = "100613574827"
                                        token = "00d5cb1fac5dc5cbfe2ff218292a2dfd33"    '用户中心查看您的token
                                        url = "https://api.ip138.com/express/info/?no="&no&"&token="&token

                                        Response.Write (GetURL(url))

                                        Function GetURL(url)
                                            on error resume next
                                            dim Retrieval
                                            Set Retrieval = Server.CreateObject("MSXML2.ServerXMLHTTP")
                                                    Retrieval.setTimeouts 600000, 600000, 600000, 600000
                                                    Retrieval.Open "GET", url, false
                                                    Retrieval.Send
                                                    GetURL = Retrieval.ResponseBody
                                            Set Retrieval = Nothing
                                            GetURL=BytesToBstr(GetURL,"utf-8")
                                        End Function

                                        Function BytesToBstr(strBody,CodeBase)
                                                dim objStream
                                                set objStream = Server.CreateObject("Adodb.Stream")
                                                objStream.Type = 1
                                                objStream.Mode =3
                                                objStream.Open
                                                objStream.Write strBody
                                                objStream.Position = 0
                                                objStream.Type = 2
                                                objStream.Charset = CodeBase
                                                BytesToBstr = objStream.ReadText 
                                                objStream.Close
                                                set objStream = nothing
                                        End Function
                                         %>
                                    

方法二

                                        <%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
                                        <% Option Explicit
                                        '=========================================================
                                        ' File      : .asp
                                        ' Version   : 1.0.0.0
                                        ' Create    : 
                                        ' Modify    : 
                                        '=========================================================
                                        ' 1.0.0.0   : 
                                        '========================================================= %>
                                        

                                        <% Dim no,token,strMid,oid,sign
                                        no = "100613574827"
                                        strMid = 777    '用户中心查看您的mid
                                        oid = 777   '用户中心查看您的oid
                                        token = "00d5cb1fac5dc5cbfe2ff218292a2dfd33"    '用户中心查看您的token
                                        url = "https://api.ip138.com/express/info/?"
                                        sign = MD5_32("no="&no&"&token="&token)
                                        %>

                                        <script type="text/javascript">
                                        
                                        </script>
                                        <script type="text/javascript" src="<%= no&"no="&no&"&callback=find&mid="&strMid&"&oid="&oid&"&sign="&sign %>"></script>