SHUTDOWN COMPUTER FROM MOBILE USING PHP

On the Internet there are some tutorials about shutting down a computer from a mobile phone.But, in this tutorial we’ll check out a way to shutdown a computer from a mobile phone using PHP.For those who don’t know PHP, it is a scripting language in simple words.We are PHP as it is a server side scripting language,platform independent and open source.That means we don’t have to worry about whether the system runs on Windows or Linux.The procedure is really simple.All we have to do is to set up a server on the computer with PHP and execute system command to shutdown the computer.

1.SERVER SETUP

We’ll use XAMPP to set up the server.Believe me it is too easy.

Go to xampp home page.Download the available package (installer or zip archive).

Now,follow the instruction given on their site to install the server.Actually installation is just unzipping the archive to a directory.The installation will take just around 2 minute.

However you check my previous post on setting up server on home computer.

2.PHP code

    • After installing XAMPP, just open up XAMPP directory.Then you will locate htdocsfolder.Open that and create a new directory/folder.You can name it anything you want.Suppose the name of the new folder is shutdown.
    • Open the newly created folder shutdown and create a new file with index.phpextension.
    • Now open up index.php file and place the nice little code if you run windows.
echo ‘Shutting down’;
exec(“shutdown -s -t 30″); //30 means shutdown after 30 seconds
?>

3.Creating URL

Go to no-ip.com and register a free sub-domain and point it to the the following

http://YOUR-IP-ADDRESS/shutdown/

To find out your ip address just visit any site like http://checkmyip.com/.

That’s it.Now you visit that link with no-ip subdomain from your mobile phone to shut down the computer.

Share this:

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s