回归

Shadow

  DonewsBlog  |  Donews首页  |  Donews社区  |  Donews邮箱  |  我的首页  |  联系作者  |  聚合   |  登录
  307篇文章 :: 0篇收藏:: 16篇评论:: 1个Trackbacks

文章

收藏

相册

论坛

软件

存档


正在读取评论……


1:====================================================
response.Write(GetBody("http://www.chinaxg.com.cn"))
Function GetBody(weburl)
    '创建对象
    Set Retrieval = CreateObject("Microsoft.XMLHTTP")
    With Retrieval
     Retrieval.Open "Get", weburl, False, "", ""
     Retrieval.Send()
     GetBody = bytes2BSTR(Retrieval.ResponseBody)
     End With
    '释放对象
    Set Retrieval = 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
===============================================================

2================================================================
response.Write(GetBody("http://www.chinaxg.com.cn"))
Function GetBody(weburl)
    '创建对象
    Dim ObjXMLHTTP
    Set ObjXMLHTTP=Server.CreateObject("MSXML2.serverXMLHTTP")
    '请求文件,以异步形式
    ObjXMLHTTP.Open "GET",weburl,False
    ObjXMLHTTP.send
    While ObjXMLHTTP.readyState <> 4
        ObjXMLHTTP.waitForResponse 1000
    Wend
    '得到结果
     GetBody=bytes2BSTR(ObjXMLHTTP.responseBody)
    '释放对象
     Set ObjXMLHTTP=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

=================================================================


3==================================================================
Dim objAdoStream
set objAdoStream = Server.createObject("ADODB.Stream")
objAdoStream.Type = 1
objAdoStream.Open()
objAdoStream.write("asdfas")
objAdoStream.SaveToFile server.MapPath("stream.htm"),2
objAdoStream.Close()
response.Write("chenggong")
response.End()

=====================================================================

4====================================================================
response.Write(BytesToBstr("asdfasdf","GB2312"))
Function BytesToBstr(body,Cset)
        dim objstream
        set objstream = Server.CreateObject("adodb.stream")
        objstream.Type = 1
        objstream.Mode =3
        objstream.Open
        objstream.Write body
        objstream.Position = 0
        objstream.Type = 2
        objstream.Charset = Cset
        BytesToBstr = objstream.ReadText
        objstream.Close
        set objstream = nothing
End Function


=====================================================================

Function BytesToBstr(body,Cset)
        dim objstream
        set objstream = Server.CreateObject("adodb.stream")
        objstream.Type = 1
        objstream.Mode =3
        objstream.Open
        objstream.Write body
        objstream.Position = 0
        objstream.Type = 2
        objstream.Charset = Cset
        BytesToBstr = objstream.ReadText
        objstream.Close
        set objstream = nothing
End Function



Trackback: http://tb.donews.net/TrackBack.aspx?PostId=804680


[点击此处收藏本文]  发表于2006年03月31日 1:41 PM




正在读取评论……

发表评论

大名:
网址:
验证码
评论