Reading a remote file or page?

Discussion in 'Javascript' started by Adrian, Jan 17, 2006.

  1. Adrian

    Adrian Guest

    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
     
    Adrian, Jan 17, 2006
    #1
    1. Advertising

  2. Adrian

    Evertjan. Guest

    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)
     
    Evertjan., Jan 17, 2006
    #2
    1. Advertising

  3. Adrian

    Adrian Guest

    Thank you Evertjan.

    "Evertjan." <> wrote in message
    news:Xns974E713921C2Aeejj99@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)
     
    Adrian, Jan 17, 2006
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Trevor
    Replies:
    1
    Views:
    657
    Steven Cheng[MSFT]
    May 30, 2005
  2. Trevor
    Replies:
    1
    Views:
    4,179
    Steven Cheng[MSFT]
    Jun 6, 2005
  3. Dayton Jones

    Remote.pm (File::Remote) problem

    Dayton Jones, Mar 1, 2006, in forum: Perl Misc
    Replies:
    9
    Views:
    213
    Dayton Jones
    Mar 3, 2006
  4. kath

    problem reading remote file.

    kath, Feb 16, 2007, in forum: Perl Misc
    Replies:
    6
    Views:
    183
    Joe Smith
    Feb 18, 2007
  5. Replies:
    3
    Views:
    95
Loading...

Share This Page