Dim i As Integer, thisCharCode As Integer, nextCharCode As Integer
Dim sReturn As String
sReturn = ""
For i = 1 To LenB(vIn)
thisCharCode = AscB(MidB(vIn, i, 1))
If thisCharCode < &H80 Then
sReturn = sReturn & Chr(thisCharCode)
Else
nextCharCode = AscB(MidB(vIn, i + 1, 1))
sReturn = sReturn & Chr(CLng(thisCharCode) * &H100 + CInt(nextCharCode))
i = i + 1
End If
Next
BytesToString = sReturn
BytesToString函数是在VB中使用的,你直接在asp中使用当然出错,再asp中这样用:
On Error Resume Next
Dim Retrieval
Dim Domain
Dim TakenHTML
Function GetURL(url)
Set Retrieval = Server.CreateObject("Microsoft.XMLHTTP")
With Retrieval
.Open "GET", url, False, "", ""
.Send
GetURL = BytesToString(.ResponseText)
End With
Set Retrieval = Nothing
End Function
Function BytesToString(vIn)
Dim i , thisCharCode , nextCharCode
Dim sReturn
sReturn = ""
For i = 1 To LenB(vIn)
thisCharCode = AscB(MidB(vIn, i, 1))
If thisCharCode < &H80 Then
sReturn = sReturn & Chr(thisCharCode)
Else
nextCharCode = AscB(MidB(vIn, i + 1, 1))
sReturn = sReturn & Chr(CLng(thisCharCode) * &H100 + CInt(nextCharCode))
i = i + 1
End If
Next
BytesToString = sReturn
<%
on error resume next
Dim Retrieval
Dim Domain
Dim TakenHTML
Function GetURL(url)
Set Retrieval = Server.CreateObject("Microsoft.XMLHTTP")
With Retrieval
.Open "GET", url, False, "", ""
.Send
GetURL = BytesToString(.ResponseBody)
End With
Set Retrieval = Nothing
End Function
TakenHTML = GetURL("http://www.net.cn/has_client/whois.asp?domain=asdfafdsa&tld=com")
Response.Write takenhtml
Function BytesToString(vIn As Variant) As String
Dim i As Integer, thisCharCode As Integer, nextCharCode As Integer
Dim sReturn As String
sReturn = ""
For i = 1 To LenB(vIn)
thisCharCode = AscB(MidB(vIn, i, 1))
If thisCharCode < &H80 Then
sReturn = sReturn & Chr(thisCharCode)
Else
nextCharCode = AscB(MidB(vIn, i + 1, 1))
sReturn = sReturn & Chr(CLng(thisCharCode) * &H100 + CInt(nextCharCode))
i = i + 1
End If
Next
BytesToString = sReturn
<%
on error resume next
Dim Retrieval
Dim Domain
Dim TakenHTML
Function GetURL(url)
Set Retrieval = Server.CreateObject("Microsoft.XMLHTTP")
With Retrieval
.Open "GET", url, False, "", ""
.Send
GetURL = .ResponseText
End With
Set Retrieval = Nothing
End Function
Dim Retrieval
Dim Domain
Dim TakenHTML
Function GetURL(url)
Set Retrieval = Server.CreateObject("Microsoft.XMLHTTP")
With Retrieval
.Open "GET", url, False, "", ""
.Send
GetURL = .ResponseText
End With
Set Retrieval = Nothing
End Function
TakenHTML = GetURL("http://www.net.cn/has_client/whois.asp?domain="这里写要查询的域名"&tld="域名类型"")
Response.Write BytesToString(TakenHtml)