Hi ZipperJJ!
Yes I want to copy the contens of the source file into a new file… but the new file is going to be in the same folder as the asp file (a folder within inetpub/www)
If http is the only way to get at that file, you will have to programmatically open an http connection from within your code. It will hit the url (the same way a browser would), read it byte by byte, and manually write to the destination file, byte by byte. If you don’t know how to do that, I’ll see what code examples I can find.
This seems like a goofy setup tho. Sometimes it’s best to work with your network admins instead of around them Surely if you have a legitimate business reason to have the file copied they can make some kind of accommodation for you?
He probably will, but while I’m letting him ponder it I am looking for alternative solutions that will save him having to compromise his intention to make everything more secure (i.e. not having the original source folder accessable by everyone - ‘annonymous user’)
I see. Well, your alternative is to read it with an http connection
You may not actually have to write all the code that does it, there are probably some helper objects that can do it for you. When you say asp script, is it running as an .asp page in an IIS server?
I wasn’t explaining to you what you’re trying to do, I was explaining to you what you SHOULD do…arseNal used better terminology.
Instead of physically copying the file you want to READ it using http and put its contents into a new file on the server you DO have access to. And then from there, copy it to the last place.
Basically you need fileserver1 to browse over to Buying and selling domains by experts | Hire a broker today! | Sedo, copy all of the text into a new document (using read) on fileserver1 (imagine opening notepad, copy and pasting) and then using the connection between fileserver1 and fileserver2 to physically copy the new document.
I have the following code written… It says ‘invalid procedure call or argument’ for the write line, yet the syntax is exactly as I’ve seen in examples on the internet
**
<%
url = “Buying and selling domains by experts | Hire a broker today! | Sedo”
set xmlhttp = CreateObject(“MSXML2.ServerXMLHTTP”)
xmlhttp.open “GET”, url, false
xmlhttp.send “”
Dim fso, MyFile
Set fso = CreateObject(“Scripting.FileSystemObject”)
Set MyFile = fso.CreateTextFile(“\destination estfile.txt”, True)
Edit: I meant to say the false and the true the other way round in the last but one reply
either way I either end up with a file I can’t use or a failed procedure call.
Well, I guess it is encountering some character that it reads from the URL that it cannot write unless the destination file is created as a unicode file. This
Set MyFile = fso.CreateTextFile("\\destination estfile.txt", True)
MyFile.Write("just a plain string")
works, yes?
If so, it probably means you have to do some debugging to figure out which character coming from the ServerXMLHTTP object is making the write call barf. Other than that, I dunno, dude. I’m not an asp programmer.
Alternately, if you can shell out to an external program from your script, you can just find a windows-built copy of the ‘wget’ utility, which in its simplest form just hits a URL and writes the resulting data to a file.
This page, linked to from the official GNU wget site, lists a location for windows binaries of wget: FrequentlyAskedQuestions