发送SSH命令PHP


Send SSH Command PHP

嘿,大家我需要一个功能,这是超级简单,并发送SSH命令从我的Web服务器与SSH2扩展安装

这是我现在使用的,但是SSH2很糟糕,不可能安装

<?php
$method = $_GET['method'];
$command = $_GET['command'];
$serverusername = $_GET['serverusername'];
$serverip = $_GET['serverip'];
$serverpassword = $_GET['serverpassword'];
$serverport = $_GET['serverport'];
if(!($con = ssh2_connect($serverip, $serverport))) die("Failed connecting to backend server.");
if(!ssh2_auth_password($con, $serverusername, $serverpassword)) die("Failed connecting to backend server.");
ssh2_exec($con, $command);
echo "Command sent";
?>

我能不能得到一个类似的东西来接受所有这些变量

$method = $_GET['method'];
$command = $_GET['command'];
$serverusername = $_GET['serverusername'];
$serverip = $_GET['serverip'];
$serverpassword = $_GET['serverpassword'];
$serverport = $_GET['serverport'];

使用这个库

这样使用:

$ssh = new Net_SSH2('www.domain.tld');
if (!$ssh->login('username', 'password')) {
    exit('Login Failed');
}
echo $ssh->exec('pwd');
echo $ssh->exec('ls -la');
?>