Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 317
  • Last Modified:

Automate saving an XML file displayed in a browser as a local file

Hi I would like to open a webpage that displays an XML file then save the content as a local XML file.

Using the 'Import XML' feature in Access works fine to a point but everytime I use the wizard it accesses the site 3 times...The problem is that I am limited to 9 webpage accesses a week (1 a day plus 2 xtra) and I want to carry out this process 5 times a week (each weekday).

Below is some cut down code based on a form with a webbrowser control

Dim URL As String
URL = "http://www.website.com/datafeed.cgi?UserID"
Me.WebBrowser2.Navigate URL
Me.Text3 = Me.WebBrowser2.Document.Body.outertext


This almost works but what i really need is the content from the view source.  Is this possible??
If I use Innerhtml instead of outertext I get a load of <Div> info etc.

Although the data is not included in the two wrongs and correct file I assume that the principal is the same for saving the source.  I have also attached an example data file for reference.
wrong1.txt
wrong2.txt
correct.txt
fullexample.txt
0
Jenkar
Asked:
Jenkar
  • 2
1 Solution
 
Leigh PurvisDatabase DeveloperCommented:
Examples of directly accessing web data (such has XML content) online... (uses MSXML object rather than an IE ActiveX control - a much lighter solution).
http:Q_23724152.html
http:Q_23168985.html
0
 
Leigh PurvisDatabase DeveloperCommented:
Oh pants.  I'm sure that link method used to work... :-s
(Was never very up to speed on it to be fair though).
Rather than guess again... here's the full links.
http://www.experts-exchange.com/Microsoft/Development/MS_Access/Q_23724152.html
http://www.experts-exchange.com/Web_Development/Web_Languages-Standards/XML/Q_23168985.html
0
 
JenkarAuthor Commented:
Thank you just slightly modified code but works perfectly!

Thanks!


Function fGetWebPost(strSourceURL As String)
    Dim xmlServerHttp As Object
    Set xmlServerHttp = CreateObject("MSXML2.ServerXMLHTTP.4.0")
  
    With xmlServerHttp
        .Open "POST", strSourceURL, False
        .setRequestHeader "Content-Type", "text/xml"
        .Send strRequest
        fGetWebPost = .responseText
    End With
    Set xmlServerHttp = Nothing
End Function

Open in new window

0

Featured Post

NFR key for Veeam Agent for Linux

Veeam is happy to provide a free NFR license for one year.  It allows for the non‑production use and valid for five workstations and two servers. Veeam Agent for Linux is a simple backup tool for your Linux installations, both on‑premises and in the public cloud.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now