473,396 Members | 1,846 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,396 software developers and data experts.

reading a remote file

hey !! ..
i am new to thsi lang...
i wanted to know how to read a file .. at remort location

eg .. suppose a file http://www.url.com/update.txt is at a site and
i am generating a page
from http://url.com/index.html
wo i want is that i get data of that page in my index.html page ..... i
am iunable to do that can any one help me out here

thanks
anant

Nov 23 '06 #1
9 2247
an*********@gmail.com escreveu:
hey !! ..
i am new to thsi lang...
i wanted to know how to read a file .. at remort location
LOL, English isn't my primary language, but at least I try to write it
right. ^^
eg .. suppose a file http://www.url.com/update.txt is at a site and
i am generating a page
from http://url.com/index.html
wo i want is that i get data of that page in my index.html page ..... i
am iunable to do that can any one help me out here
Look for XMLHttpRequest on any search engine and you'll have what you
need, thus, due to security reasons, you can only load resources from
the same domain, if you want to access external domains, you'll have to
write a "proxy script" in your server and load resources through it.
--
Jonas Raoni Soares Silva
http://www.jsfromhell.com
Nov 24 '06 #2
Jonas Raoni wrote:
an*********@gmail.com escreveu:
eg .. suppose a file http://www.url.com/update.txt is at a site and
i am generating a page
from http://url.com/index.html
wo i want is that i get data of that page in my index.html page ..... i
am iunable to do that can any one help me out here

Look for XMLHttpRequest on any search engine and you'll have what you
need, thus, due to security reasons, you can only load resources from
the same domain, if you want to access external domains, you'll have to
write a "proxy script" in your server and load resources through it.
XMLHttpRequest can be used to fetch any resource that is accessible by
HTTP. It must not reside on the same domain. I think you are confusing
XMLHttpRequest with the security model of cross-domain scripting.

--
Bart

Nov 24 '06 #3
Bart Van der Donck wrote:
Jonas Raoni wrote:
>Look for XMLHttpRequest on any search engine and you'll have what you
need, thus, due to security reasons, you can only load resources from
the same domain, if you want to access external domains, you'll have to
write a "proxy script" in your server and load resources through it.

XMLHttpRequest can be used to fetch any resource that is accessible by
HTTP. It must not reside on the same domain. I think you are confusing
XMLHttpRequest with the security model of cross-domain scripting.
No, Jonas is correct, with XMLHttpRequest and normal security settings
script inside the browser can only make requests back to the origin the
(HTML or XML) document with the script comes from.

With IE you have different security zones where you can configure e.g.
the trusted site zone to allow access to other origins.

--

Martin Honnen
http://JavaScript.FAQTs.com/
Nov 24 '06 #4
Martin Honnen wrote:
No, Jonas is correct, with XMLHttpRequest and normal security settings
script inside the browser can only make requests back to the origin the
(HTML or XML) document with the script comes from.
Yes Jonas is right. It appears that I mixed javascript's XMLHttpRequest
with Perl's HTTP::Request.

--
Bart

Nov 24 '06 #5
Hi,

Bart Van der Donck wrote:
Martin Honnen wrote:
>No, Jonas is correct, with XMLHttpRequest and normal security settings
script inside the browser can only make requests back to the origin the
(HTML or XML) document with the script comes from.

Yes Jonas is right. It appears that I mixed javascript's XMLHttpRequest
with Perl's HTTP::Request.
The restriction is only for clients. All the server languages I know
allow to make cross-domain HTTP calls. The client-side restriction is
annoying.

Laurent
--
Laurent Bugnion, GalaSoft
Software engineering: http://www.galasoft-LB.ch
PhotoAlbum: http://www.galasoft-LB.ch/pictures
Support children in Calcutta: http://www.calcutta-espoir.ch
Nov 24 '06 #6
Laurent Bugnion escreveu:
Bart Van der Donck wrote:
>Yes Jonas is right. It appears that I mixed javascript's XMLHttpRequest
with Perl's HTTP::Request.

The restriction is only for clients. All the server languages I know
allow to make cross-domain HTTP calls. The client-side restriction is
annoying.
Yes, but we're talking just about JavaScript :]

And I preffer to have this restriction, otherwise the JavaScript could
"send me" to sites where I didn't wanted to go, use me to make DoS
attacks to other servers, steal information from sites where I'm logged
on, etc, there are a lot of possibilities. And since it must be a
regular request, it should record the cookies from the foreign site,
well, I consider this a security issue, it's really "annoying" for the
programmer, anyway you can remove this restriction by making a proxy.
--
Jonas Raoni Soares Silva
http://www.jsfromhell.com
Nov 24 '06 #7
thanks all

guys i found the solution ... all tha ks to u ppl...

thanks once again for helping me out... there
Jonas Raoni wrote:
Laurent Bugnion escreveu:
Bart Van der Donck wrote:
Yes Jonas is right. It appears that I mixed javascript's XMLHttpRequest
with Perl's HTTP::Request.
The restriction is only for clients. All the server languages I know
allow to make cross-domain HTTP calls. The client-side restriction is
annoying.

Yes, but we're talking just about JavaScript :]

And I preffer to have this restriction, otherwise the JavaScript could
"send me" to sites where I didn't wanted to go, use me to make DoS
attacks to other servers, steal information from sites where I'm logged
on, etc, there are a lot of possibilities. And since it must be a
regular request, it should record the cookies from the foreign site,
well, I consider this a security issue, it's really "annoying" for the
programmer, anyway you can remove this restriction by making a proxy.
--
Jonas Raoni Soares Silva
http://www.jsfromhell.com
Nov 24 '06 #8
VK

Jonas Raoni wrote:
And I preffer to have this restriction, otherwise the JavaScript could
"send me" to sites where I didn't wanted to go, use me to make DoS
attacks to other servers, steal information from sites where I'm logged
on, etc, there are a lot of possibilities.
But all of them imply that you have to come first on a malicious site
(Google, Yahoo etc. surely will not do it with you :-) And malicious
sites simply use content grabbers ("server negotiators") and they
don't care about this limitation (and never did). The only effect this
cross-domain lock has is in forcing legal contractors to search on
hacker sites for corporate solutions - and respectively act as hackers
on well-respectful servers.

Nov 24 '06 #9
VK said the following on 11/24/2006 12:33 PM:
Jonas Raoni wrote:
>And I preffer to have this restriction, otherwise the JavaScript could
"send me" to sites where I didn't wanted to go, use me to make DoS
attacks to other servers, steal information from sites where I'm logged
on, etc, there are a lot of possibilities.

But all of them imply that you have to come first on a malicious site
(Google, Yahoo etc. surely will not do it with you :-)
I have never implied it, I will say it bluntly.

And malicious sites simply use content grabbers ("server negotiators")
and they don't care about this limitation (and never did).
They do it on the server because the *can't* do it on the client.

If they relaxed the cross-domain security restriction tomorrow then in a
week you would see it fixed again as the hackers/spammers/wannabes would
be exploiting it.

--
Randy
Chance Favors The Prepared Mind
comp.lang.javascript FAQ - http://jibbering.com/faq
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/
Nov 24 '06 #10

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

Similar topics

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: Paul Fi | last post by:
I have this problem with .NET remoting: my remote class is called RemoteHandler which implements an interface called IEazyRemoting which has only one method to be implemented which is my server...
1
by: Trevor | last post by:
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...
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...
2
by: Adrian | last post by:
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...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
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...

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.