VB6 Homeplug XML file download

Forum regarding Windows Software and Home Automation Domotica.

VB6 Homeplug XML file download

Postby hacker007 » Sat Aug 15, 2009 11:59 am

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: August 2009
Location: Slovenia

VB6 Homeplug XML file download

Postby hacker007 » Sat Aug 15, 2009 12:26 pm

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.
hacker007
Starting Member
Starting Member
 
Posts: 2
Joined: August 2009
Location: Slovenia

VB6 Homeplug XML file download

Postby Bwired » Sat Aug 15, 2009 10:05 pm

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">
User avatar
Bwired
Administrator
Administrator
 
Posts: 5304
Joined: March 2006
Location: Netherlands

VB6 Homeplug XML file download

Postby Erik » Sun Aug 16, 2009 7:51 pm

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
Erik
Starting Member
Starting Member
 
Posts: 45
Joined: December 2008
Location: Netherlands


Return to Windows Forum

Who is online

Users browsing this forum: No registered users and 1 guest