Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 7 of 7
  1. #1
    Regular Coder
    Join Date
    Jul 2004
    Location
    Tampa
    Posts
    223
    Thanks
    23
    Thanked 0 Times in 0 Posts

    PHP execute file on client's machine

    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 Code:
    <?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.
    Last edited by dprichard; 12-13-2010 at 07:44 PM.

  • #2
    Senior Coder Rowsdower!'s Avatar
    Join Date
    Oct 2008
    Location
    Some say it's everything.
    Posts
    2,027
    Thanks
    5
    Thanked 397 Times in 390 Posts
    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.
    The object of opening the mind, as of opening the mouth, is to shut it again on something solid. –G.K. Chesterton
    See Mediocrity in its Infancy
    It's usually a good idea to start out with this at the VERY TOP of your CSS: * {border:0;margin:0;padding:0;}
    Seek and you shall find... basically:
    validate your markup | view your page cross-browser/cross-platform | free web tutorials | free hosting

  • #3
    Regular Coder
    Join Date
    Jul 2004
    Location
    Tampa
    Posts
    223
    Thanks
    23
    Thanked 0 Times in 0 Posts
    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.

  • #4
    Senior Coder Rowsdower!'s Avatar
    Join Date
    Oct 2008
    Location
    Some say it's everything.
    Posts
    2,027
    Thanks
    5
    Thanked 397 Times in 390 Posts
    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...
    The object of opening the mind, as of opening the mouth, is to shut it again on something solid. –G.K. Chesterton
    See Mediocrity in its Infancy
    It's usually a good idea to start out with this at the VERY TOP of your CSS: * {border:0;margin:0;padding:0;}
    Seek and you shall find... basically:
    validate your markup | view your page cross-browser/cross-platform | free web tutorials | free hosting

  • #5
    Regular Coder
    Join Date
    Nov 2010
    Location
    Oregon
    Posts
    243
    Thanks
    23
    Thanked 10 Times in 10 Posts
    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.

  • #6
    God Emperor Fou-Lu's Avatar
    Join Date
    Sep 2002
    Location
    Saskatoon, Saskatchewan
    Posts
    16,987
    Thanks
    4
    Thanked 2,660 Times in 2,629 Posts
    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.
    PHP Code:
    header('HTTP/1.1 420 Enhance Your Calm'); 

  • #7
    Regular Coder
    Join Date
    Nov 2010
    Location
    Oregon
    Posts
    243
    Thanks
    23
    Thanked 10 Times in 10 Posts
    Quote Originally Posted by Fou-Lu View Post
    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!
    Last edited by DataTalk; 12-14-2010 at 10:02 PM.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •