nbsp; Dim dtStart As Date
dtStart = Now()
strCmd = "GET " & strURI & " HTTP/1.0" & vbCrLf
strCmd = strCmd & "User-Agent: aspHttp.http" & vbCrLf
strCmd = strCmd & "Accept: */*" & vbCrLf
strCmd = strCmd & vbCrLf
objWinSock.SendData strCmd
Do Until objWinSock.State = sckClosing
DoEvents
If DateDiff("s", dtStart, Now) > 60 Then
Err.Raise vbObjectError, "Error", "请求超时"
End If
Loop
End Sub
Public Property Get Head() As Variant
Head = strHead
End Property
Public Property Get Body() As Variant
Body = strData
End Property
Private Sub objWinSock_DataArrival(ByVal bytesTotal As Long)
Dim strTemp
objWinSock.GetData strTemp, vbString
strData = strData & strTemp
End Sub
Private Sub objWinSock_Connect()
bConnected = True
End Sub
Private Sub objWinSock_Error(ByVal Number As Integer, Description As String, _
ByVal Scode As Long, ByVal Source As String, ByVal HelpFile As String, _
ByVal HelpContext As Long, CancelDisplay As Boolean)
Err.Raise vbObjectError, "Error", "Winsock Error: " & Number &
vbCrLf & Description
CancelDisplay = True
End Sub
编译该组件,然后按照下面的步骤注册该组件
C: et stop iisadmin /y
C:mtxstop
编译成Active Dll
C: et start w3svc
在ASP中调用这个组件
<%@ Language=VBScript %>
<HTML>
<HEAD>
<META NAME="GENERATOR" Content="Microsoft Visual Studio 6.0">
</HEAD>
<BODY>
<%
Dim obj
Set obj = Server.CreateObject("aspHttp.http")
Response.Write obj.httpGet("http://www.chinaasp.com.cn")
%>
</BODY>
</HTML>
dtStart = Now()
strCmd = "GET " & strURI & " HTTP/1.0" & vbCrLf
strCmd = strCmd & "User-Agent: aspHttp.http" & vbCrLf
strCmd = strCmd & "Accept: */*" & vbCrLf
strCmd = strCmd & vbCrLf
objWinSock.SendData strCmd
Do Until objWinSock.State = sckClosing
DoEvents
If DateDiff("s", dtStart, Now) > 60 Then
Err.Raise vbObjectError, "Error", "请求超时"
End If
Loop
End Sub
Public Property Get Head() As Variant
Head = strHead
End Property
Public Property Get Body() As Variant
Body = strData
End Property
Private Sub objWinSock_DataArrival(ByVal bytesTotal As Long)
Dim strTemp
objWinSock.GetData strTemp, vbString
strData = strData & strTemp
End Sub
Private Sub objWinSock_Connect()
bConnected = True
End Sub
Private Sub objWinSock_Error(ByVal Number As Integer, Description As String, _
ByVal Scode As Long, ByVal Source As String, ByVal HelpFile As String, _
ByVal HelpContext As Long, CancelDisplay As Boolean)
Err.Raise vbObjectError, "Error", "Winsock Error: " & Number &
vbCrLf & Description
CancelDisplay = True
End Sub
编译该组件,然后按照下面的步骤注册该组件
C: et stop iisadmin /y
C:mtxstop
编译成Active Dll
C: et start w3svc
在ASP中调用这个组件
<%@ Language=VBScript %>
<HTML>
<HEAD>
<META NAME="GENERATOR" Content="Microsoft Visual Studio 6.0">
</HEAD>
<BODY>
<%
Dim obj
Set obj = Server.CreateObject("aspHttp.http")
Response.Write obj.httpGet("http://www.chinaasp.com.cn")
%>
</BODY>
</HTML>