Forum Moderators: open

Message Too Old, No Replies

Opening External Files Strangeness

I have no idea what is going on!

         

lufiaguy

4:39 pm on Apr 23, 2005 (gmt 0)

10+ Year Member



Hi,

I have little to no experience in ASP, but I had to search the web for some code to help out with a problem. I have a text file on an external Unix-based server, and I need to get it onto this Windows server by running a script. Here is the code:

<%
Dim FSO, TextStream
Dim url, strContent
Dim objXMLHTTP, xml

Set FSO = Server.CreateObject("Scripting.FileSystemObject")

url = "http://dynamic5.example.com/~lufia/forum/newsdata.txt"
Set xml = Server.CreateObject("Microsoft.XMLHTTP")
xml.Open "GET", url, False
xml.Send
strContent = xml.responseText
Set xml = Nothing

Set TextStream = FSO.OpenTextFile(Server.MapPath("includes\newssystem.txt"), 2, True, 0)
TextStream.Write(strContent)
TextStream.Close
Set TextStream = Nothing
Set FSO = Nothing
%>

The script is meant to get the contents of [dynamic5.example.com...] then store it in [example.net...]

This ASP won't work properly. It keeps updating newssystem.txt with data from 6 hours ago, or 4 hours ago. It never seems to put the current data in in the file, even though the file on the Unix-based server is always updated. Is there any way round this? Thanks.

[edited by: Xoc at 7:08 am (utc) on April 26, 2005]
[edit reason] Use example.com for examples [/edit]

lufiaguy

7:34 pm on Apr 23, 2005 (gmt 0)

10+ Year Member



OK, this script is crashing frequently now, giving access denied messages, 500 errors... it occasionally works; I don't know why. Is there any other way of getting that data across?