I've got a few servers that I'd like to connect to every so often to run a program. However, to make it easier, I'd like to make a PHP script connect to each of them via remote desktop and run each of them. Is this possible? If so, where should I start? An example would be lovely.
"Remote Control" is a PHP class library that allows you to programically control a remote device via its CLI interface (usually via SSH or Telnet) or any other command via STDIN and STDOUT using Expect in an easy to use object oriented manner.
In theory you could implement a PHP script that could communicate with a server in the RDP protocol, but I certainly wouldn't want to try to build a script that can do anything meaningful, as RDP is built to expose a remote machine's user interface to the connected client and PHP is built first and foremost to manipulate text.
If you want a PHP script to remotely control another computer, then SSH is a far more sensible option, as PHP could easily connect to the remote cmputer's CLI and issue commands to the server via shell commands, which are textual and therefore easily generated with PHP.
On the other hand, interfacing with the remote computer with RDP would be extremely difficult. Just think about clicking on an icon to get a directory listing for a start. You'd first have to determine where the mouse pointer is, whether the icon you want to click is visible and if so where its bounding box is relative to the mouse pointer. You'd then have to issue commands to move the mouse pointer to within the bounding box, then check that the mouse pointer is in the right place (a local or other remote user might be moving the mouse around) and then issue a pair of clicks with a short delay between them.
That's going to be a lot harder than issuing "cd C:\Program Files\" followed by "dir", for example.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With