asp读取远程URL网页html代码

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)
Set Retrieval = Server.CreateObject(“Microsoft.XMLHTTP”)
With Retrieval
.Open “GET”, url, False, “”, “”
.setRequestHeader “Content-Type”,”application/x-www-form-urlencoded”
.Send
GetURL = .ResponseText
GetURL = bytes2BSTR(.Responsebody)
End With
Set Retrieval = Nothing
End Function

发表回复

您的电子邮箱地址不会被公开。 必填项已用*标注