Home > Web Front-end > JS Tutorial > body text

Convert with ADODB.Stream_javascript tips

WBOY
Release: 2016-05-16 19:20:24
Original
1370 people have browsed it

Use ADODB.Stream to convert, use the streamtochar function





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>
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template