用ADODB.Stream转换

时间:2024-04-22 13:23:52 

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

<HTML>
<html>
<head>
<META http-equiv="Content-Type" content="text/html; charset=Big5">
<title>test</title>
<SCRIPT LANGUAGE="JavaScript">
<!--
window.onerror = function (err) {
return false;
    };

//-->
</SCRIPT>
<script language="vbscript">
<!--

'获取地址 
dim sUrl

sUrl="http://www.aastocks.com/chi/Login/Login.asp"
Function streamtochar(StrStream)
   set stream=CreateObject("ADODB.Stream")
       stream.type=1
       stream.Mode=3
       stream.Open 
       stream.Write Strstream
       stream.Position= 0
       stream.Type= 2
       stream.Charset="BIG5"
       streamtochar= stream.ReadText
       stream.Close
   set stream=nothing
End Function

'Function bytes2BSTR(vIn)
' strReturn = ""
' For i = 1 To LenB(vIn)
' ThisCharCode = AscB(MidB(vIn,i,1))
' If ThisCharCode < &H80 Then
' strReturn = strReturn & Chr(ThisCharCode)
' Else
' NextCharCode = AscB(MidB(vIn,i+1,1))
' strReturn = strReturn & Chr(CLng(ThisCharCode) * &H100 + CInt(NextCharCode))
i = i + 1
' End If
' Next
' bytes2BSTR = strReturn
'End Function

'函数,得到内容
function getContentByUrl(url)

'建立对象
set oXmlHttp = CreateObject("MSXML2.XMLHTTP")

oXmlHttp.open "GET",url,false

oXmlHttp.send

getContentByUrl = streamtochar(oXmlHttp.responseBody)

set oXmlHttp=nothing
end function

'函数,获得网站内容
function getRealContent(url)
sContent = getContentByUrl(url)

getRealContent=sContent
end function

'-->
</script>
</head>
<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
<SCRIPT LANGUAGE=vbscript>
<!--
str=getRealContent(sUrl)
'document.write "<xmp>"&str &"</xmp>"
'document.write str 
document.write "<META http-equiv=""Content-Type"" content=""text/html; charset=Big5"">"&str

'-->
</SCRIPT>
</BODY>
</HTML>

标签:用ADODB.Stream转换
0
投稿

猜你喜欢

  • 基于python框架Scrapy爬取自己的博客内容过程详解

    2021-12-21 06:39:30
  • IDEA版使用Java操作Redis数据库的方法

    2024-01-19 22:15:34
  • go sync.Once实现高效单例模式详解

    2024-02-05 05:49:37
  • python实现剪切功能

    2023-02-27 17:52:01
  • Python+Selenium自动化实现分页(pagination)处理

    2022-02-23 20:09:52
  • python爬取招聘要求等信息实例

    2021-01-27 21:22:36
  • 如何把IP表存到SQL数据库里去?

    2009-11-02 20:21:00
  • vue2.0基于vue-cli+element-ui制作树形treeTable

    2024-05-09 10:50:53
  • Python 短视频爬虫教程

    2022-02-13 00:17:33
  • Python-jenkins模块获取jobs的执行状态操作

    2022-07-29 14:15:09
  • document.getElementById的简写方式

    2010-06-21 10:44:00
  • php购物车实现方法

    2023-11-16 22:54:51
  • 关于浮动的前世今生

    2009-08-19 18:51:00
  • asp base64加解密函数代码

    2011-03-31 11:02:00
  • python绘图subplots函数使用模板的示例代码

    2023-05-23 06:05:01
  • SQL进行排序、分组、统计的10个新技巧分享

    2024-01-17 22:44:12
  • Python hashlib模块详细讲解使用方法

    2021-09-11 12:08:16
  • [组图]手把手教你制作ASP留言本

    2007-09-22 09:32:00
  • Oracle与SQL Server在企业应用的比较

    2010-07-20 13:34:00
  • python 爬取知乎回答下的微信8.0状态视频

    2022-09-11 15:17:57
  • asp之家 网络编程 m.aspxhome.com