Re: [OT] JavaScript with socket function
On Dec 20, 2007, at 5:49 PM, Nelson Castillo wrote:
> On Dec 20, 2007 1:06 PM, Misko <asdrtg-mlist@yahoo.com.au> 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 debian-user-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
Received on Fri Dec 21 15:47:21 2007
This archive was generated by hypermail 2.1.8
: Wed Feb 27 2008 - 23:01:53 EST
|