Hello Everyone!
Is it possible to grab the contents of a webpage and store the value into a variable? We have a script that generates one line of text for a correlating inDesign file on our webserver. Rather than having to our website and copy/paste the line into their inDesign file, it would be wonderful to automate this task by being able to have a script fetch this line. Is there any documentation explaining a method to grab the contents of a file (in my case a webpage) or does anyone know how to accomplish something like this?
Thanks in advance!
Yes. See Chapter 6 of the Javascript Tools Guide, which has this example:
reply = "";
conn = new Socket;
// access Adobe’s home page
if (conn.open ("www.adobe.com:80")) {
// send a HTTP GET request
conn.write ("GET /index.html HTTP/1.0\n\n");
// and read the server’s reply
reply = conn.read(999999);
conn.close();
}
[ In CS3 there was an Http object, but you couldn't use it from InDesign anyhow, only Bridge. Anyone know what happened to that? ]
North America
Europe, Middle East and Africa
Asia Pacific