VB6 Homeplug XML file download

Forum regarding Windows Software and Home Automation Domotica.
Post Reply
hacker007
Starting Member
Starting Member
Posts: 2
Joined: Sat Aug 15, 2009 12:56 pm
Location: Slovenia
Contact:

VB6 Homeplug XML file download

Post 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
hacker007
Starting Member
Starting Member
Posts: 2
Joined: Sat Aug 15, 2009 12:56 pm
Location: Slovenia
Contact:

VB6 Homeplug XML file download

Post 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.
Bwired
Administrator
Administrator
Posts: 4704
Joined: Sat Mar 25, 2006 1:07 am
Location: Netherlands
Contact:

VB6 Homeplug XML file download

Post 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">
Erik
Starting Member
Starting Member
Posts: 45
Joined: Thu Dec 04, 2008 7:42 pm
Location: Netherlands

VB6 Homeplug XML file download

Post 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
Post Reply

Return to “Windows Forum”