日期:2014-05-16 浏览次数:20917 次
{"resultcode":"200","reason":"Return Successd","result":{"province":"浙江","city":"杭州","areacode":"0571","zip":"310000","company":"中国联通","card":"联通130卡"},"error_code":0}
<script runat="server" language="jscript">
function getJSON(v) {return eval('('+v+')');}
</script>
<%
'==================================================
'从2进制数据流生成内容
'==================================================
Function BytesToBstr(strBody,CodeBase)
dim obj
set obj=Server.CreateObject("Adodb.Stream")
obj.Type=1
obj.Mode=3
obj.Open
obj.Write strBody
obj.Position=0
obj.Type=2
obj.Charset=CodeBase
BytesToBstr=obj.ReadText
obj.Close
set obj=nothing
End Function
function downpage(url)
set xhr=server.CreateObject("microsoft.xmlhttp")
xhr.open "get",url,false
xhr.send
downpage=BytesToBstr(xhr.responsebody,"gb2312")'注意你那个页面的编码,要不可能出乱码
end function
's改为用Microsoft.XMLHTTP动态获取
's=downpage("http://www.xxx.com/?id=13116711097")
s="{""resultcode"":""200"",""reason"":""Return Successd"",""result"":{""province"":""浙江"",""city"":""杭州"",""areacode"":""0571"",""zip"":""310000"",""company"":""中国联通"",""card"":""联通130卡""},""error_code"":0}"
set o=getJSON(s)
response.Write(o.result.province)
set o=nothing
%>