注:对方接口已收费,大家可以找其他的接口,文章仅提供处理操作思路 <%@Language="VBScript" CodePage="65001"%> <% '请求手机号码 chkPhone.asp?m=13763038876 req = Trim(request.QueryString("m")) if left(req,1)="1" and len(req)=11 then theResult = GetData(req) response.Write("Mobile : ") response.Write(GetMid(theResult,"'Mobile':'","',")) response.Write("<br>From : ") response.Write(GetMid(theResult,"'Province':'","',")) response.Write("-") response.Write(GetMid(theResult,"'City':'","',")) response.Write("<br>Type : ") response.Write(GetMid(theResult,"'Corp':'","',")) else response.Write("Error") end if function GetData(theMobile) dim thestatus Dim objXMLHTTP, xml Set xml = Server.CreateObject("Microsoft.XMLHTTP") httpsendurl="http://vip.showji.com/locating/?m=" & theMobile & "&outfmt=json&callback=phone.callBack" xml.Open "GET", httpsendurl, False xml.Send thestatus = bytes2BSTR(xml.responseBody) thestatus = replace(thestatus,"""","'") Set xml = Nothing GetData = thestatus End function Function bytes2BSTR(arrBytes) strReturn = "" arrBytes = CStr(arrBytes) For i = 1 To LenB(arrBytes) ThisCharCode = AscB(MidB(arrBytes, i, 1)) If ThisCharCode < &H80 Then strReturn = strReturn & Chr(ThisCharCode) Else NextCharCode = AscB(MidB(arrBytes, i+1, 1)) strReturn = strReturn & Chr(CLng(ThisCharCode) * &H100 + CInt(NextCharCode)) i = i + 1 End If Next bytes2BSTR = strReturn End Function Function GetLeft(Con, tag) if instr(con,tag)>0 then GetLeft = Left(Con, InStr(Con, tag) - 1) else GetLeft = "" end if End Function Function GetRight(Con, tag) if instr(con,tag)>0 then GetRight = Right(Con, Len(Con) - InStr(Con, tag) - Len(tag) + 1) else GetRight = "" end if End Function Function GetMid(Con, tag1, tag2) if instr(con,tag1)>0 and instr(con,tag2)>0 then GetMid = GetLeft(GetRight(Con, tag1), tag2) else GetMid = "" end if End Function %> 注意,asp文档必须是UTF-8编码。