Page 1 of 1

VB6 Homeplug XML file download

Posted: Sat Aug 15, 2009 12:59 pm
by hacker007
I am sorry to bother you, but I have been working on this problem for 3 days now and cannot find the right piece of VB6 code.
I want to download my Plugwise XML file 4 times a minute with code:

Dim objHTTP As Object
Set objHTTP = CreateObject("MSXML2.XMLHTTP")
Dim stl As String
Dim rt
objHTTP.Open "GET", file_URL$, False, "password", "password"
objHTTP.send
rt = objHTTP.responseBody
Dim oADOStream
Set oADOStream = CreateObject("ADODB.Stream")
oADOStream.Type = 1
oADOStream.Mode = 3
oADOStream.Open
oADOStream.Write rt
oADOStream.SaveToFile xmlfilesaveto, 2 'adSaveCreateOverWrite
oADOStream.Close
Set oADOStream = Nothing
Set objHTTP = Nothing

It downloads the XML file, but downloaded file stays the same in content, only file attributes change (file save to disk time). If I check XML file via brower I see changes in XML every 5 seconds.

What should I do?

Thank you very much,
Rok Rodic

VB6 Homeplug XML file download

Posted: Sat Aug 15, 2009 1:26 pm
by hacker007
Well I solved the problem by using suggestion from another forum:
Private Declare Function DeleteUrlCacheEntry Lib "Wininet.dll" _
Alias "DeleteUrlCacheEntryA" _
(ByVal lpszUrlName As String) As Long

This clears the cache.

VB6 Homeplug XML file download

Posted: Sat Aug 15, 2009 11:05 pm
by Bwired
I had some problems as well with the cashing.
I load the XML in a browserobject because I want to be able to see the result as well
I use the webbrowser.refresh which works also.

<hr noshade size="1"><font size="1">Pieter Knuvers
http://www.bwired.nl <i>Online House in the netherlands. Domotica, Home Automation.</i></font id="size1">

VB6 Homeplug XML file download

Posted: Sun Aug 16, 2009 8:51 pm
by Erik
This should work

set xmlDoc=CreateObject("Microsoft.XMLDOM")
xmlDoc.async="false"
xmlDoc.load("yourfile.xml")

for each x in xmlDoc.documentElement.childNodes
document.write(x.nodename)
document.write(": ")
document.write(x.text)
next