Saturday, May 27, 2006

Microsoft.XMLHTTP and cached data

Once I had a problem with Microsoft.XMLHTTP object. It used cached results from previous fetch.
I solved the problem by appending a unique parameter to the URL, which caused the object to fetch the new result each time.
Something like this:


Sub Initialize
Dim oHTTP As Variant
Dim strUrl As String
Dim strReturn As String

strUrl = ""+cstr(timer())

Set oHTTP = CreateObject("Microsoft.XMLHTTP") "GET", strUrl, False, "", ""
strReturn = oHTTP.responseText
Set oHTTP = Nothing
msgbox strReturn
End Sub


dmanbrock said...

Brilliant. Just the fix I've been looking for!

Unknown said...
This comment has been removed by the author.
dave gellert said...

thanks man you saved my bacon