reading a remote file

A

ananttickoo

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
 
J

Jonas Raoni

(e-mail address removed) 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.
 
B

Bart Van der Donck

Jonas said:
(e-mail address removed) escreveu:

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.
 
M

Martin Honnen

Bart said:
Jonas Raoni wrote:

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.
 
B

Bart Van der Donck

Martin said:
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.
 
L

Laurent Bugnion

Hi,
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
 
J

Jonas Raoni

Laurent Bugnion escreveu:
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.
 
A

ananttickoo

thanks all

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

thanks once again for helping me out... there
Jonas said:
Laurent Bugnion escreveu:
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.
 
V

VK

Jonas said:
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.
 
R

Randy Webb

VK said the following on 11/24/2006 12:33 PM:
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.
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,007
Latest member
obedient dusk

Latest Threads

Top