用ADODB.Stream转换
转换 stream adodb
2023-06-13 09:13: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>
<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>
相关文章
- Favicon.ico图片在线制作网站PHP源码+支持多种图片格式转换-星泽V社
- 二进制如何转十进制?_二进制转换为十进制的算法
- sql的隐式转换_js强制转换和隐式转换
- 单细胞数据分析中scran包进行细胞周期分析时细胞周期marker基因的转换
- SIGGRAPH 2022 | Palette: 针对图像转换的扩散模型
- 实现不同编程语言间的自由代码转换需要注意些什么?【经验分享】
- NSData 与 NSString,Byte数组,UIImage 的相互转换详解手机开发
- 用JavaScript将数字转换为大写金额详解编程语言
- Java中Date与String的相互转换详解编程语言
- SAP 金额在表中的存储及货币转换因子详解编程语言
- Linux atoi函数:字符串转换为整数(linuxatoi)
- 为 pdfLinux快速转换文件为PDF的方法(linux转换文件)
- MySQL数据类型BIT转换指南(mysqlbit转换)
- MySQL数据库:实现跨平台的转换(mysql数据库转换)
- Oracle中数值转换成百分比的方法(oracle中转换百分比)
- 转换中文日期的PHP程序