level 1
aaa40799
楼主
Private Function getHTTPPage(URL, Cset)
Dim http
On Error Resume Next
Set http = CreateObject("MSXML2.XMLHTTP")
DoEvents
http.Open "GET ", URL, False
DoEvents
http.send
DoEvents
If err.Number = -2146697211 Then
MsgBox "网络不通,连通后再试一试!!"
Exit Function
End If
If http.ReadyState <> 4 Then
Exit Function
End If
getHTTPPage = BytesToBstr(http.ResponseBody, Cset)
Set http = Nothing
If err.Number <> 0 Then err.Clear
End Function
Private Function BytesToBstr(body, Cset)
Dim objstream
Set objstream = CreateObject("adodb.stream")
objstream.Type = 1
objstream.Mode = 3
objstream.Open
objstream.Write body
objstream.position = 0
objstream.Type = 2
objstream.Charset = Cset
BytesToBstr = objstream.ReadText
objstream.Close
Set objstream = Nothing
End Function
strw = getHTTPPage( "https://tieba.baidu.com/f?kw=vb", "GB2312") ------第2次getHTTPPage好像是直接读取的缓存。如何刷新
2011年04月22日 07点04分
1
Dim http
On Error Resume Next
Set http = CreateObject("MSXML2.XMLHTTP")
DoEvents
http.Open "GET ", URL, False
DoEvents
http.send
DoEvents
If err.Number = -2146697211 Then
MsgBox "网络不通,连通后再试一试!!"
Exit Function
End If
If http.ReadyState <> 4 Then
Exit Function
End If
getHTTPPage = BytesToBstr(http.ResponseBody, Cset)
Set http = Nothing
If err.Number <> 0 Then err.Clear
End Function
Private Function BytesToBstr(body, Cset)
Dim objstream
Set objstream = CreateObject("adodb.stream")
objstream.Type = 1
objstream.Mode = 3
objstream.Open
objstream.Write body
objstream.position = 0
objstream.Type = 2
objstream.Charset = Cset
BytesToBstr = objstream.ReadText
objstream.Close
Set objstream = Nothing
End Function
strw = getHTTPPage( "https://tieba.baidu.com/f?kw=vb", "GB2312") ------第2次getHTTPPage好像是直接读取的缓存。如何刷新