首页 > web前端 > js教程 > 用ADODB.Stream转换_javascript技巧

用ADODB.Stream转换_javascript技巧

WBOY
发布: 2016-05-16 19:20:24
原创
1404 人浏览过

用ADODB.Stream转换,用streamtochar这个函数





test
<script> <BR><!-- <BR>window.onerror = function (err) { <BR>return false; <BR> }; <br><br>//--> <BR></script>
<script> <BR><!-- <br><br>'获取地址 <BR>dim sUrl <br><br>sUrl="http://www.aastocks.com/chi/Login/Login.asp" <BR>Function streamtochar(StrStream) <BR> set stream=CreateObject("ADODB.Stream") <BR> stream.type=1 <BR> stream.Mode=3 <BR> stream.Open <BR> stream.Write Strstream <BR> stream.Position= 0 <BR> stream.Type= 2 <BR> stream.Charset="BIG5" <BR> streamtochar= stream.ReadText <BR> stream.Close <BR> set stream=nothing <BR>End Function <br><br>'Function bytes2BSTR(vIn) <BR>' strReturn = "" <BR>' For i = 1 To LenB(vIn) <BR>' ThisCharCode = AscB(MidB(vIn,i,1)) <BR>' If ThisCharCode < &H80 Then <BR>' strReturn = strReturn & Chr(ThisCharCode) <BR>' Else <BR>' NextCharCode = AscB(MidB(vIn,i+1,1)) <BR>' strReturn = strReturn & Chr(CLng(ThisCharCode) * &H100 + CInt(NextCharCode)) <BR>i = i + 1 <BR>' End If <BR>' Next <BR>' bytes2BSTR = strReturn <BR>'End Function <br><br>'函数,得到内容 <BR>function getContentByUrl(url) <br><br>'建立对象 <BR>set oXmlHttp = CreateObject("MSXML2.XMLHTTP") <br><br>oXmlHttp.open "GET",url,false <br><br>oXmlHttp.send <br><br>getContentByUrl = streamtochar(oXmlHttp.responseBody) <br><br>set oXmlHttp=nothing <BR>end function <br><br><BR>'函数,获得网站内容 <BR>function getRealContent(url) <BR>sContent = getContentByUrl(url) <br><br><BR>getRealContent=sContent <BR>end function <br><br><BR>'--> <BR></script>


<script> <BR><!-- <BR>str=getRealContent(sUrl) <BR>'document.write "<xmp>"&str &"" <BR>'document.write str <BR>document.write "<META http-equiv=""Content-Type"" content=""text/html; charset=Big5"">"&str <br><br>'--> <BR></script>

相关标签:
来源:php.cn
本站声明
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn
热门教程
更多>
最新下载
更多>
网站特效
网站源码
网站素材
前端模板