Solved

Launch external application from a website

Posted on 2009-07-11
9
447 Views
Last Modified: 2012-05-07
How could I lauch an external application from my website. I know how to run a batch file from php but the batch file will not execute an external applications when it is called from php. The batch file will just do stuff like coping files inscide the www root folder. I am creating this webpage for my personal use only and I want it to have links to the programs I use the most. How could I have a link that will open iTunes on my computer for example? I am using wamp 5 on my vista computer.
0
Comment
Question by:TonoNam
  • 4
  • 4
9 Comments
 
LVL 4

Expert Comment

by:khyer123
ID: 24832619
0
 
LVL 33

Expert Comment

by:Slick812
ID: 24846244
Hello TonoNam, , As far as I know, due to security reasons, you will not be able to launch applications for a "Windows" OS, from a web page, using PHP or any other web host scripting language, or any other web page methods. . . as you have seen the "BAT FILE" was prevented from that. . . I have seen some "DirectX" that have some limited access to an executable, but making a direct X DLL for windows is not something for a PHP developer to try and do. .  again, you do NOT want a web page to be able to fire up executables, it would be a security mess.
0
 

Author Comment

by:TonoNam
ID: 24851045
Yeah but I am hosting my webpage locally. I and people that have the password to my network will be the only ones that will be able to call those external applications. I can control several things with my computer such as the lights on my room, TV etc and it will be nice that I can run the batch files that do all that kind of stuff with my webpage that is hosted locally so that I can do that on any computer on my network (I want to do that with my iPhone). When my iPhone is on the same network I am able to access my www root folder and access the files that I have in there. I can also run batch files through my iPhone but not the ones that execute external programs. Maybe I have to use another scripting language such as JavaScript or vba script. It will be very nice if I could make this work. I then will be able to control my computer TV and light with my iPhone. Or maybe I will have to change the security settings on my computer. I will appreciate a lot your help on this matter.
0
 
LVL 33

Expert Comment

by:Slick812
ID: 24853319
Sorry, but I do not believe that you can run programs from a "Web Page" in an internet browser, no matter what you may change the security settings to, or use javascript (VB script). I tried to do that some years ago, when the browser security was MUCH less than it is now. .  The reason a browser can not do certain things to the operating system, is because you do not want a web page to come on and then format your hard drive, erase your registry, or send an email with your info in it. .  I will not say that it is NOT possible, but I really do not think it is possible without some sort of buffer over-run hack or other malicious code hack.
As I said before, you might can get that functioning from an Active X in IE, but because of the same security concerns, ActiveX in browsers, are also somewhat restricted. I think there is an ActiveX development area here at Experts Ex, you might ask for an opinion there about if what you want to do is possible with activeX, but unless you can program in a windows executable compile program (Visual Studio), it may not do you much good. I do not see may posts here, for your question, so I guess it is not done much, and PHP is the wrong place to ask this question, in my dumb opinion.
0
IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 
LVL 33

Expert Comment

by:Slick812
ID: 24853381
I re-read your question, are you running your PHP in your local system or on your remote web server system. . . If you are running PHP in your local machine windows OS, you may be able to run executables, but I do not Know about doing that, . . . . I assumed that you were referring to a remote Web Server running PHP
0
 

Author Comment

by:TonoNam
ID: 24854335
I am runing php in my local system only. I know how to execute batch files with php but the batch files will just do struff like copy files, creating directories etc. but The batch files will not launch external programs when called from php and I am sure that that has something to do with security reasons because the batch file will run perfectly fine when runed independently by me. I am sure that I should consider not doing this if my webpage was in a remote web server but since it can only be accessed localy (on the computers on my network)  I dont understand why it does not enable me to lauch external programs. I have batch files that control the lights on my room and other batch files that will turn the tv on my room. It will be nice if I could create some links on my local webpage so that I can also run those batch files on other coputers that are on my network even on my iphone cause when I conent my iPhone to my netwok I am able to acces my webpage. I have a passord on my network and I trust everyone that has acces to my network so I dont mind that the poople on my network acces my webpage because I know they will not do any harm to my computer. It will be very nice if I could make this work.
0
 

Author Comment

by:TonoNam
ID: 24854345
sorry if I am not explaining my self clearly. If you have any questions please feel free to ask. Maybe I am not explaining myself clearly.
0
 

Author Comment

by:TonoNam
ID: 24854789
I have done something that works but it is kind of dum. I created a batch file called listener.bat that it checks if a file turnTVOn.txt exits. If it does NOT exits then it will pause two seconds using the spring command and then loop again infinitely. In my webpage I have a link named Turn tv on that when I click on it, it creates a txt file called turnTVOn.txt and because the batch file listener.bat is still looping it will eventualy see that the file turnTVOn.txt exits. if turnTVOn.txt exitsts then listener.bat (the batch file that is looping until it finds turnTVOn.txt )  then it will run another batch file called turnTv.bat and what that batch file does is that it turns the tv on my room and it also deletes the text file turnTVOn.txt so that listener.bat still loops infinitely. It will be nice if I cold use a better technique. I will be tedios to write a batch file for every program that I want to execute on my local network. I've been thinking about this for so long that I came up with this stupid idea lol. At least it works....
0
 
LVL 33

Accepted Solution

by:
Slick812 earned 500 total points
ID: 24860128
Sorry about my uninformed responses, I know very little about PHP and MS Windows OS application , however, I know that in Apatche, linux setups, any executables in your "Web Space" folders (as defined by the Apatche web server software), can NOT access any files or folders outside of the available web space area (folder, directory), I would image that Windows web server set-up also would restrict access (by php, bat file, dll, exe) to the same area. It's my view that PHP and web server set-up is not designed for the type of thing you are trying to do. I find your looping bat file a creative way to experiment (it runs in your user process). But if you are going to have more than one user (on your network), the tcip connection of web server does not use a system  "user" ID for incoming requests, so it would not know which user process (monitor) to place the TV process into unless there was some other provision for that.

You may want to drop this question, and ask a new question about changing access rights in a Windows-PHP web server, It's not likely you will get many more experts responding here, and there may not be any that have ever tried to do what you want to do in a Web Server environment., ,  My thoughts, duhhh . . The main way a web server interacts with the outside environment is with the tcip data transfer (file transfer mostly), but I would guess that a tcip contact to an outside application to run the programs you want might work, but I have never done that, and don't know what to do for it. . . . just a thought.
0

Featured Post

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

Suggested Solutions

International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
These days socially coordinated efforts have turned into a critical requirement for enterprises.
In this tutorial viewers will learn how to embed videos in a webpage using HTML5. Ensure your DOCTYPE declaration is set to HTML5: "<!DOCTYPE html>": Use the <video> tag to insert a video. Define the src as the URL of your video; this is similar to …
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

706 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now