...

View Full Version : PHP execute file on client's machine



dprichard
12-13-2010, 08:38 PM
We have a client who has a software exe called callnumber that has to be executed to do the screen pops for their software. The executable resides on each individual user's machine and not the server. I put a copy on the server and it works using this:



<?php
if(isset($_GET['calling']) && $_GET['calling'] != '' && isset($_GET['called']) && $_GET['called'] != '')
{
$calling = $_GET['calling'];
$called = $_GET['called'];
exec("callnumber $calling $called");
}
?>


I am trying to find out if it is possible to launch the executable and send the variables to it if the executable is on the individual user's machines instead of the server. I have physical access to all the machines so I can change whatever setting is necessary, but not sure if this is even possible. Any direction would be greatly appreciated. :):)

Rowsdower!
12-13-2010, 08:55 PM
As far as I know browser security wouldn't allow this unless you had a plugin for this *.exe to work in the browser.

Think along the lines of Flash or Adobe Reader. You can't access Adobe products on a user's machine unless they have their plugins for them installed and enabled. It would be pretty much the same thing for your *.exe so you would have to develop a plugin for your users to install (or see if one exists from the software manufacturer) and then work out the interface to send/receive data and execute code that way.

This stuff is over my head, but this is how I understand it to work.

dprichard
12-13-2010, 08:59 PM
Yeah, I was thinking the browser security would never allow this. I mean they harden against stuff like this because of viruses and such. I was hoping that since I had physical access to the machines that there may be a way though.

Rowsdower!
12-13-2010, 09:06 PM
Browser plugins are the only way I know of, but like I said - this stuff is over my head. Someone with better knowledge may pop in and set the course straight it I'm wrong...

DataTalk
12-14-2010, 07:13 PM
Its not recommended to do this, but try creating a .bat file with your php text editor, include the absolute path the file you want to execute.

You can use php to write the necessary code in a text editor, and output to a .txt file, except output to the .bat file. Then create another .bat file to execute that file. With a little tinkering and access to www. on the localhost you can make this happen.

Fou-Lu
12-14-2010, 07:36 PM
The only way I can think of using PHP to do this is to have a client machine running a serviced program that will allow you to establish a socket connection with the client from the server. Using this you can communicate with the client, but you still cannot force them to execute another program. Once you start doing things like socketing, you'd be better of choosing a different language to do this with.

PHP cannot execute a program on a client otherwise; that would be a massive security risk.
The batch file will not work. That would become a local machine application that is executing only because the machine is the server. What needs to happen is the client has to initiate the conversation with the host and listen for the host to give it commands.

DataTalk
12-14-2010, 08:16 PM
The only way I can think of using PHP to do this is to have a client machine running a serviced program that will allow you to establish a socket connection with the client from the server. Using this you can communicate with the client, but you still cannot force them to execute another program. Once you start doing things like socketing, you'd be better of choosing a different language to do this with.

PHP cannot execute a program on a client otherwise; that would be a massive security risk.
The batch file will not work. That would become a local machine application that is executing only because the machine is the server. What needs to happen is the client has to initiate the conversation with the host and listen for the host to give it commands.

I do this frequently using a different method, your logic makes sense the work around with PHP may not be worth the risk or the reward!...Unless we are doing run bat = $100's.exe in real bills then I will find a way!



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum