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
JenkarAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

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

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
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
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Development

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.