'添加Command1 Winsock1 Richtextbox1 Text1 Text2
'RichTextBox1.ScrollBars = rtfBoth
'在Text1输入域名, Text2输入网址, 点击 Command1
Option Explicit
Dim myall$, aa$, jj&, kk&, strCommand$, strWebPage$
Private Sub Form_Load()
Winsock1.Protocol = 0
Winsock1.RemotePort = 80
Text1.Text = "BBS.CHIAN95.NET"
Text2.Text = "BBS.CHIAN95.NET"
End Sub
Private Sub Command1_Click()
Winsock1.Close
RichTextBox1.Text = ""
Winsock1.RemoteHost = Text1.Text
strWebPage = Text2.Text
Winsock1.Connect '开始提取数据
End Sub
Private Sub Winsock1_Connect()
strCommand = "GET " + strWebPage + " HTTP/1.0" + vbCrLf
strCommand = strCommand + "Accept: */*" + vbCrLf
strCommand = strCommand + "Accept: text/html" + vbCrLf
strCommand = strCommand + vbCrLf
Winsock1.SendData strCommand '发送命令
End Sub
Private Sub Winsock1_DataArrival(ByVal bytesTotal As Long)
'开始下载,收到数据时,发生DataarriVal事件
On Error Resume Next
Dim webData As String
Winsock1.GetData webData, vbString
RichTextBox1.Text = RichTextBox1.Text & webData '取得相关的网页文件
End Sub
其它慢了,WINSOCK速度快些,我是批量提取的
慕哥9229398
蛊毒传说