473,421 Members | 1,650 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,421 software developers and data experts.

Reading a remote file or page?

Hi
I have some local pages (on PC harddisk) that act as a user interface
and a set of JS files that controls it all. I now want to be able to access
a remote web server to read a txt file and use the result in my local
script.

eg

Remote text file i.e. conf.txt

XYZ http:\\www.xyz.com\test?me=you

ABC http:\\www.abc.com\test

end

the file is to be opened and read from the remote server my interface would
then know when a user types XYZ <enter> to open
http:\\www.xyz.com\test?me=you within a frame.

so how do I open read and close a remote file say www.test.com/config.txt ?

thanks
Jan 17 '06 #1
2 17358
Adrian wrote on 17 jan 2006 in comp.lang.javascript:
I have some local pages (on PC harddisk) that act as a user interface
and a set of JS files that controls it all. I now want to be able to
access a remote web server to read a txt file and use the result in my
local script.


In IE:

function getUrl(url) {
var http = new ActiveXObject("microsoft.xmlhttp");
http.open("GET",url,false);
http.send();
return http.responseText;
}

theFile = getUrl('http://myServer.com/myFile.txt')

===============

You will need to change the IE security settings in
options->advanced->"Allow active content..my computer",
I seem to remember.

--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
Jan 17 '06 #2
Thank you Evertjan.

"Evertjan." <ex**************@interxnl.net> wrote in message
news:Xn********************@194.109.133.242...
Adrian wrote on 17 jan 2006 in comp.lang.javascript:
I have some local pages (on PC harddisk) that act as a user interface
and a set of JS files that controls it all. I now want to be able to
access a remote web server to read a txt file and use the result in my
local script.


In IE:

function getUrl(url) {
var http = new ActiveXObject("microsoft.xmlhttp");
http.open("GET",url,false);
http.send();
return http.responseText;
}

theFile = getUrl('http://myServer.com/myFile.txt')

===============

You will need to change the IE security settings in
options->advanced->"Allow active content..my computer",
I seem to remember.

--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)

Jan 17 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
by: Matt Daleo | last post by:
I'm attempting to read a remote file and parse it for data. The problem I'm having is that the file seems to be generated by Perl (http://alert.dot.pima.gov/scripts/1brpssd.pl) and when I read it...
1
by: Red Golpe | last post by:
I've managed to read from a local database using only javascript and the DAO ActiveX object, but I can't make it work with a remote database. When I change the connection string from "C:\..." to...
4
by: JoelWhitehouse | last post by:
Hi! I want to write a script that will read a .php file on a remote server and print to the current page a portion of the text contained in the remote file. I am just wondering what the best...
1
by: Roberto Castro | last post by:
I have some problems with the way I am showing the BLOB fields in the Image web controls. It does work on my localhost though sometimes I need to hit Refresh for the images to load properly....
1
by: POnfri | last post by:
Hi, I have a problem in a peace of code were i'm doing a file copy using File.Copy. The Source is local and the target is a remote machine. Example: File.Copy(C:\temp\hi.txt,...
2
by: Jeff | last post by:
I have an ASP.NET web page accessing a SQL database. I've used VS to build the app and stored it in the eNPTest02 directory of my localhost on my development machine. The database is on the web. ...
1
by: Trevor | last post by:
I posted this message last week but seem to be missing a few days posts. We currently run our web site in php and are now converting it to asp.net to match the rest of our business that is .net...
29
by: Jerim79 | last post by:
I did try to find the answer to this before posting, so this isn't a knee jerk reaction. What I am trying to accomplish is to have a script that opens a cookie, reads a value, and then use a...
5
by: ycquak | last post by:
Hi, Currently I need to read contents from a dynamic page, which goes something like: http://servername/filename.jsp?arg1=a&arg2=b The content is not static, neither is there a file for me to...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.