On Dec 20, 2007, at 5:49 PM, Nelson Castillo wrote:
On Dec 20, 2007 1:06 PM, Misko <[EMAIL PROTECTED]> wrote:
I am trying to write some JavaScript function in web page
that can fetch other web page from internet, store it in
variable, parse and present some extracted data from that
other page. I just do not know how to fetch other page.
I guess I am looking for some kind of socket
function in JavaScript (like fsockopen() in PHP).
Is there such thing?
Search for XMLHttpRequest.
http://en.wikipedia.org/wiki/XMLHttpRequest
You might want to use it to retrieve HTTP(S) documents (can be XML).
I think you cannot open pages that are not hosted in the same host
the original page (the one with the JS code) is. (I am not sure now).
Regards,
Nelson.'
You cannot use javascript to write files (assuming you want to save
them, or the results of
parsing the files). This is a security measure that every commercial
browser uses. It prevents
arbitrary scripts from reading, writing or modifying files on the
client machine.You will have to
use a server side technology like php, perl, or ruby. This can either
be done as command line
scripts or under the auspices of a web server. It sounds like you are
looking at Curl 'c'+ url.
JK
--
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]