Copy link to clipboard
Copied
Hi,
I'm working on a web base application, and I need to execute a PHP file in a script written in Javascript (InDesign).
I only need to "open" this file (like a page in a Browser), I don't need to work with it. I only need to have that page (file) executed.
Someone can provide help, please?
Thanks and best regards.
Copy link to clipboard
Copied
Hi,
On windows you can do something like this:
Copy link to clipboard
Copied
Hi 2i Geert and thanks for the idea.
I have made it with:
reply = "";
conn = new Socket();
if (conn.open("192.168.91.184:8888)) { // my port and host
conn.write(" GET /myfile.php?" + variousVariable + " HTTP/1.0\n\n");
reply = conn.read(999999);
conn.close;
}
With this code, the myfile.php seems to been executed.
But I'm still searching for a better solution.
Copy link to clipboard
Copied
The answer is No.
You sound awfully confused. Web browsers do not execute PHP scripts -- web servers do. So your analogy ("like a page in a Browser") doesn't make any sense.
I do not understand what you mean by "open". That doesn't seem to have anything to do with executing.
But in any event, InDesign does not include a php interpreter.
I suppose you could use an external PHP interpreter to evalute your PHP code, but it dosn't seem like a very good idea and probably wouldn't work for oyu, even though it could theoretically.
What is it that you are trying to accomplish? Please include a realistic example, because what you're asking just doesn't make any sense.
Copy link to clipboard
Copied
The answer is Yes
However, I managed to make it work with the code I have written above, so it's possible.
The example:
I'm working on a plugin for InDesign, and I have some Javascript scritps.
One of these scripts need to call a PHP page that is present on a server. I use the code above to call it (with variables and GET) and make it execute.
It's the server that actually execute the PHP code, but only when my Javascript script's call it.
And this work fine, so, this is possible
Anyway, I'm still wondering why it works...
Copy link to clipboard
Copied
Well, sure, if you want the SERVER to execute the PHP then that makes
perfect sense. That's not what you asked for, though. It is easy to
change a No into a Yes by changing the requirements.
You say you are wondering "why it works"? What is the question?
Why would it not work?
InDesign can be a web client, just like any other browser (have fun
rendering anything you get back that's in HTML, but that's a different
story.)
Copy link to clipboard
Copied
Alt!
I do not want and did not want to disrespect anyone.
I surely write wrong problem specifications, but the important thing is that we found a solution.
Copy link to clipboard
Copied
OK, so you're all set! Great! I thought you had another question...