PDA

View Full Version : Copying an external XML file (using ASP)


BigEric
04-20-2007, 01:34 AM
I apologize in advance for probably asking a very newbie type question. I would imagine my query is simple, yet with all my years of developing, I have done very little work with XML - simply a factor of the projects I work on.

So here goes....

I was given a URL of an external xml file. Let's call it www.anyurl.com/file.xml

I want to simply GET the file and copy the entire file onto our server.

I have code that includes this:

set objHTTP = Server.CreateObject("Microsoft.XMLHTTP")
objHTTP.open "GET", "http://www.anyurl.com/file.xml", false
objHTTP.send

I can get the contents of the file and read the response text. However, this is not what I want to do. I want to read this external file (just as if it was a flat file) and make an exact duplicate of the file for saving on my server.

Any simple ways to do this? Whatever help anyone can offer would be tremendously appreciated.

Thank you in advance.

Eric :confused:

david_kw
04-20-2007, 03:13 PM
You might want to try getting this thread moved to the ASP forum. It doesn't appear to be an XML question at all since you just want to move it as a flat file.

Sorry I can't help. I know very little about ASP.

Good luck.

david_kw

BigEric
04-20-2007, 03:18 PM
Thanks David.

Is there a fast way to transfer this to the ASP forum?

david_kw
04-20-2007, 03:46 PM
Honestly, I haven't done it yet so I'm not positive. It sounds like you can private message a moderator and they will do it for you. The moderator for this board is Alex Vincent

http://www.codingforums.com/member.php?u=7

If you don't get a timely response, I've seen people create a new post in the new forum and say they were recommended to move this question and link back to this post.

Hopefully the moderator can take care of it for you. I'm afraid not sure if you can PM just this boards moderator or any.

david_kw

Alex Vincent
04-20-2007, 08:35 PM
I've just moved this thread. I wasn't sure about the move until you requested it. :)

BigEric
04-20-2007, 08:38 PM
Thank you Alex!!!

david_kw
04-22-2007, 04:37 AM
Hopefully someone here knows an actual answer but just in case here is some stuff to read about that might help.

http://forums.devshed.com/delphi-programming-90/download-a-file-196846.html
http://www.aurigma.com/Support/DocViewer/2/WorkingwithURL.htm.aspx
http://msconline.maconstate.edu/tutorials/ASPNET2/ASPNET13/aspnet13-05.aspx

david_kw

Basscyst
04-25-2007, 01:45 AM
Getting the response text from an xmlhttp request is an exact copy of the file as it is served.

If you need to put that data in a file on your server, all you need to do is create a text file using the file system object (http://www.w3schools.com/asp/asp_ref_filesystem.asp), give it a xml file extension and write the contents of your response text to the file you created. Now you have an exact copy of the xml file.

5 cents worth, free of charge:

If the xml file is always available at the remote url, it can be read, parsed and displayed from that location at anytime and the data thearin will be as up to date as possible. Unless you have need to keep an archive of the provided data, I see no benefit to saving a copy to your server's file system.

Basscyst