怎么用ASP获取一个网页的HTML代码
< DOCTYPE html PUBLIC -WCDTD XHTML StrictEN httpwwwworgTRxhtmlDTDxhtml-strictdtd>
Private Function bytes2BSTR(vIn) '字符串函数
Dim i, ThischrCode, NextchrCode
strReturn = ""
For i = 1 To LenB(vIn)
ThischrCode = AscB(MidB(vIn, i, 1))
If ThischrCode < &H80 Then
strReturn = strReturn & Chr(ThischrCode)
Else
NextchrCode = AscB(MidB(vIn, i + 1, 1))
strReturn = strReturn & Chr(CLng(ThischrCode) * &H100 + CInt(NextchrCode))
i = i + 1
End If
Next
bytes2BSTR = strReturn
End Function
Function GetURL(url) '字符方式的xmlhttp
Set Retrieval = Server.CreateObject("Microsoft.XMLHTTP")
With Retrieval
.Open "post", url, False, "", ""
.Send
GetURL = .ResponseText
GetURL = bytes2BSTR(.Responsebody)
End With
Set Retrieval = Nothing
End Function
用的时候这样
strs=geturl("http://www.xxxx.com")
strs就是得到的源码
Dim i, ThischrCode, NextchrCode
strReturn = ""
For i = 1 To LenB(vIn)
ThischrCode = AscB(MidB(vIn, i, 1))
If ThischrCode < &H80 Then
strReturn = strReturn & Chr(ThischrCode)
Else
NextchrCode = AscB(MidB(vIn, i + 1, 1))
strReturn = strReturn & Chr(CLng(ThischrCode) * &H100 + CInt(NextchrCode))
i = i + 1
End If
Next
bytes2BSTR = strReturn
End Function
Function GetURL(url) '字符方式的xmlhttp
Set Retrieval = Server.CreateObject("Microsoft.XMLHTTP")
With Retrieval
.Open "post", url, False, "", ""
.Send
GetURL = .ResponseText
GetURL = bytes2BSTR(.Responsebody)
End With
Set Retrieval = Nothing
End Function
用的时候这样
strs=geturl("http://www.xxxx.com")
strs就是得到的源码