Solved

Use URL to open a remote textfile using OpenTextFile function?

Posted on 2003-11-12
3
919 Views
Last Modified: 2010-05-18
Im trying to open a textfile on a remote location...
This is what I've come up with... But it doesnt work...

Set fso=Server.CreateObject("Scripting.FileSystemObject")
Set otf=fso.OpenTextFile("http://mywebsite/folder/index.html",1,false)

Are there any other alternatives that anyone can think of?

Thanks for your time...
0
Comment
Question by:c0rrupti0n
  • 2
3 Comments
 
LVL 58

Expert Comment

by:Gary
ID: 9736636
FSO is for local files only
<%
Set objXMLHTTP = server.CreateObject("Microsoft.XMLHTTP")
 
objXMLHTTP.Open "post", "http://www.intouchmedialtd.com/file.txt", False
objXMLHTTP.Send

PageContent = objXMLHTTP.responseText
response.write pagecontent
%>
0
 
LVL 1

Author Comment

by:c0rrupti0n
ID: 9738653
Well I tried your example (GaryC123) and no go... I keep getting an error HTTP/1.0 501 Not Implemented in my browser. I did some research and found similar examples http://www.w3schools.com/dom/dom_http.asp. However those didnt seem to work either. I then came across this...

http://support.microsoft.com/default.aspx?scid=http://support.microsoft.com:80/support/kb/articles/Q237/9/06.ASP&NoWebContent=1

I believe this might be why its not working... and even if it did Im still uncertain it would work out because I need to use the OpenTextFile function in FSO.

Im trying to grap a text file from a remote web server. Parse it to find certain text in the files.

I need the use of the follow Sub functions of OpenTextFile:

Read
Skipline
Skip

Thanks for the swift response...
0
 
LVL 58

Accepted Solution

by:
Gary earned 20 total points
ID: 9738758
If you're having problems with it then use the GET method

<%
Set objXMLHTTP = server.CreateObject("Microsoft.XMLHTTP")
 
objXMLHTTP.Open "get", "http://www.intouchmedialtd.com/product.txt", false
objXMLHTTP.Send

PageContent = objXMLHTTP.responseText
response.write pagecontent
%>

Apart from that there's nothing you can do
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I recently decide that I needed a way to make my pages scream on the net.   While searching around how I can accomplish this I stumbled across a great article that stated "minimize the server requests." I got to thinking, hey, I use more than one…
I have helped a lot of people on EE with their coding sources and have enjoyed near about every minute of it. Sometimes it can get a little tedious but it is always a challenge and the one thing that I always say is:  The Exchange of information …
Established in 1997, Technology Architects has become one of the most reputable technology solutions companies in the country. TA have been providing businesses with cost effective state-of-the-art solutions and unparalleled service that is designed…

766 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question