What I want is a PHP file that I can call that shuts a computer down using SSH. Simple as that. Below is something that I've knocked up. Obviously, it doesn't work. I'm no PHP expert. Maybe a PHP expert could show me how to get it working. Thanks.
<?php
include('Net/SSH2.php');
$ssh = new Net_SSH2('192.168.1.124');
if (!$ssh->login('username', 'password')) {
exit('Login Failed');
}
$ssh->write("sudo shutdown -h now");
sleep(5);
$ssh->write("password\n");
?>