473,806 Members | 2,371 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 17406
Adrian wrote on 17 jan 2006 in comp.lang.javas cript:
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.xmlht tp");
http.open("GET" ,url,false);
http.send();
return http.responseTe xt;
}

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******** ************@19 4.109.133.242.. .
Adrian wrote on 17 jan 2006 in comp.lang.javas cript:
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.xmlht tp");
http.open("GET" ,url,false);
http.send();
return http.responseTe xt;
}

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
8464
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 the script-generated data is not displayed. When I view the page with a browser the data is displayed just fine. I've tried using the built-in PHP commands to read the file (file, fget) as well as the all of the Snoopy "fetch" classes...
1
2225
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 "http://..." it doesn't work any more. Any suggestion? Red Golpe ______________________________________________ "What does not kill you... makes you stronger"
4
2300
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 method is for reading from a file in this case - the file is only a few bytes long. I've seen a tutorial or two that only tangentially addresses my problem, and even then each one has varied greatly as to which object they utilize. Any ideas to...
1
3304
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. However, when I try to access the same page from another machine or when I test the code on a remote server the images just wouldn't show. The page I am talking about has 3 Image web controls. In the CodeBehind I am loading these controls by using an...
1
3902
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, \\myremote\c$\temp\hi.txt, true); This API is run from a web service that exposes it. The problem is as follows: 1) I request a page (On the web service machine) from my web server (Note
2
2201
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. I've found a way that works on the web, and I'm trying to get it to also work in debug mode in the IDE. The "on the web" page and my SQL database are hosted by a third party (on separate servers). Since debug mode opens IE and loads my page...
1
3326
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 based. I have tried using the following code layout to open the file I require but get an illigal character exception when I try and open the file. Dim sFileName As String =...
29
3015
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 switch/case to take action based on that value in the cookie. I want to set the cookie manually, so I don't need setcookie(). I see that in PHP it stores the cookie in memory. Is there a way to have PHP just read a cookie from the desktop machine?...
5
2672
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 read from. Thus, I would like to know how could I accomplish this task in php. I saw from forums, there is a similar implementation of the RSS reader which reads it in the following way:
0
9597
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10618
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10366
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
10110
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9187
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6877
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
4329
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3850
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3008
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.