1,502
社区成员
发帖
与我相关
我的任务
分享
Private Sub Command1_Click()
Dim b() As Byte
'取消所有操作
Inet1.Cancel
'设定协议为 HTTP
Inet1.Protocol = icHTTP
'设定 URL 属性
Inet1.URL = Text1.Text
'将读取的 HTML 数据放进一个 byte array.
b() = Inet1.OpenURL(, icByteArray)
'建立一个暂存文件來存放取回來的 html 文件
Open Text2.text For Binary Access Write As #1
Put #1, , b()
Close #1
End Sub
Private Sub Command1_Click()
Dim url As String, p As Long, temp As String, i As Long, n As Long, v() As String
url = "http://ren.baidu.com/uquerys/?type=3&age_from=18&age_to=20&pn="
With CreateObject("Msxml2.XMLHTTP")
Do
p = p + 1
.Open "GET", url & p, False
.send
temp = StrConv(.responsebody, vbUnicode, &H804)
If InStr(temp, "下一页") = 0 Then Exit Do
temp = Split(Split(temp, "s.src=")(2), """")(1)
.Open "geT", temp, False
.send
v = Split(StrConv(.responsebody, vbUnicode, &H804), "username: ")
For i = 1 To UBound(v)
n = n + 1
Debug.Print n; Split(v(i), """")(1)
Next
Debug.Print
Loop
End With
End Sub