用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>
Déclaration:Le contenu de cet article est volontairement contribué par les internautes et les droits d'auteur appartiennent à l'auteur original. Ce site n'assume aucune responsabilité légale correspondante. Si vous trouvez un contenu suspecté de plagiat ou de contrefaçon, veuillez contacter admin@php.cn