sachleenblogprojectsabout me

back Send commands to your computer from your iPhone

Thought it'd be fun to see what I could do on my computer from my iPhone so I wrote a simple PHP script that executes commands on the host. I also found a nifty command line tool called NirCmd that allows you to do a ton of things by specifying parameters to the program. Pair the two together and I can adjust the system volume, turn the display on/off, and a bunch of other stuff, all from my iPhone or any other remote device.

The only requirement is to have a web server running on the host computer with PHP. I use EasyPHP, which is pretty easy to get setup and use. Since EasyPHP is designed for development, the default Apache settings don't allow remote connections. You can change this by opening up httpd.conf (right click EasyPHP icon in systray > Configuration > Apache) and scrolling down to around line 50 to the Listen section. Add the following line under the Listen section.

Listen 80

Once you've got it running, drop the files into your www folder (in the EasyPHP Program Files folder) and navigate to your computer's IP address from another device. You may be greeted with a message saying "You are not allowd to view this page." This is to prevent anybody from running commands on your computer. Open up index.php and whitelist the device's IP address and try again.

The features I've provided are just examples, you can edit index.php and add your own to do whatever you want. I even put in a textbox at the bottom to allow you to execute custom commands that aren't in the list. You can execute anything you could run from the Command Prompt. One useful feature you could add is the ability to shut down your computer. This way, you could remotely have it log off, reboot, or shut down.

If you're not using Windows, none of default commands will work but your custom commands will work just fine.

The real purpose of this was actually to make up for my lack of iOS development skills. Now if I have some hardware that I can control from my computer, I should be able to control it from my iPhone, wirelessly!

Download