jesushax Posted July 15, 2009 Share Posted July 15, 2009 hi all what i want to do is to be able to launch command prompt from a php link and use data from the link to ping an address so example i click ping(url ping.php?IP=1.1.1.1) this computer command prompt is launched and it pings the the ip cotained in the link, is this possible? i want to launch VNC and RDP from links to if that is possible? THanks Quote Link to comment https://forums.phpfreaks.com/topic/166048-solved-launch-programs-from-a-link-and-use-form-data/ Share on other sites More sharing options...
trq Posted July 15, 2009 Share Posted July 15, 2009 Why would you want to the command prompt to open? What OS are you using? Quote Link to comment https://forums.phpfreaks.com/topic/166048-solved-launch-programs-from-a-link-and-use-form-data/#findComment-875695 Share on other sites More sharing options...
phporcaffeine Posted July 15, 2009 Share Posted July 15, 2009 Okay, your getting a bit beyond the scope of PHP here ... You can, through the use of exec() and system() ... run or execute command line tools like ping however. You can even have it open up a command window/terminal. I think for what your trying to do though, it would be best to make a batch file, then execute the batch file from PHP. Quote Link to comment https://forums.phpfreaks.com/topic/166048-solved-launch-programs-from-a-link-and-use-form-data/#findComment-875696 Share on other sites More sharing options...
jesushax Posted July 15, 2009 Author Share Posted July 15, 2009 can you show me an example of opening a command prompt via php and ive never created a batch file before so wouldnt know where to start with that :| any hints? Thanks Quote Link to comment https://forums.phpfreaks.com/topic/166048-solved-launch-programs-from-a-link-and-use-form-data/#findComment-875699 Share on other sites More sharing options...
trq Posted July 15, 2009 Share Posted July 15, 2009 Again, what OS are you planning on executing this on? Quote Link to comment https://forums.phpfreaks.com/topic/166048-solved-launch-programs-from-a-link-and-use-form-data/#findComment-875715 Share on other sites More sharing options...
jesushax Posted July 15, 2009 Author Share Posted July 15, 2009 os would be vista or xp is that a problem that it might be either? Quote Link to comment https://forums.phpfreaks.com/topic/166048-solved-launch-programs-from-a-link-and-use-form-data/#findComment-875716 Share on other sites More sharing options...
phporcaffeine Posted July 15, 2009 Share Posted July 15, 2009 You may try: <?php exec('c:\windows\system32\cmd.exe'); ?> But that may not do anything. PHP isn't really designed to run interactively ... Even so, what is the purpose of just opening the command window? It would better serve you if you just executed the actual command utility that you want. Quote Link to comment https://forums.phpfreaks.com/topic/166048-solved-launch-programs-from-a-link-and-use-form-data/#findComment-875734 Share on other sites More sharing options...
jesushax Posted July 15, 2009 Author Share Posted July 15, 2009 It would better serve you if you just executed the actual command utility that you want. how would i do it this way? and for the running RDP on click is that likey to work at all? Quote Link to comment https://forums.phpfreaks.com/topic/166048-solved-launch-programs-from-a-link-and-use-form-data/#findComment-875751 Share on other sites More sharing options...
RichardRotterdam Posted July 15, 2009 Share Posted July 15, 2009 Just in case you are unaware I'm letting you know. using exec() or system() will run on the server not the client. If you want to see a terminal interface that you can use to enter commands to execute on the server your way is just not gonna cut it. As for the OS mattering. It matters wether the OS of the server is linux, unix windows or whatever OS is out there that runs PHP. For example using exec() on a windows OS means you can run .exe files or .bat files. On a linux server those two wont work. Quote Link to comment https://forums.phpfreaks.com/topic/166048-solved-launch-programs-from-a-link-and-use-form-data/#findComment-875760 Share on other sites More sharing options...
jesushax Posted July 15, 2009 Author Share Posted July 15, 2009 ah right thanks for that info i wanted it to run client side, so i guess thats out the window i think ill just drop the idea and type in the IP for RDP or VNC then, just thought i could save myself 0.5 seconds by not typing lol Thanks though Quote Link to comment https://forums.phpfreaks.com/topic/166048-solved-launch-programs-from-a-link-and-use-form-data/#findComment-875767 Share on other sites More sharing options...
phporcaffeine Posted July 15, 2009 Share Posted July 15, 2009 If your looking for a way to make your server-side app invoke local, client-side commands on a users computer then it won't work 'out-of-the-box', Nor would you want it to. Imagine an internet where web developers could have web sites 'activate' tools on your OS just cause you viewed their web site. What you want to do is possible though through things like Java Applets and ActiveX Objects, both of which require a conscious client authorization and installation. Quote Link to comment https://forums.phpfreaks.com/topic/166048-solved-launch-programs-from-a-link-and-use-form-data/#findComment-875787 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.