Hey all,
Just playing around with ssh2 and would like some advice. My end goal would be having a form that a user fills, then have the parameters of the form parsed to ssh2 a command executed on the remote server with the parameters defined above, all in php.
What I have so far is the HTML form and some PHP to set variables as the form input.
and
Problem comes in with the ssh2 function ssh2_exec syntax. I want to execute 'mkdir <string>' on the remote server. I have the basic SSH auth (with key) so I just need to know how to define the command.
I am very new to programming and this is just because I like playing around with it, I know PHP isn't the best option, so please just try and assist me with this.
Thanks
Just playing around with ssh2 and would like some advice. My end goal would be having a form that a user fills, then have the parameters of the form parsed to ssh2 a command executed on the remote server with the parameters defined above, all in php.
What I have so far is the HTML form and some PHP to set variables as the form input.
<form action="test.php" method="post"><br>
<p>string: </p> <input type="text" name="string" /><br>
<br><input type="submit" value="send" /><input type="reset" />
</form>
and
<?php
$string = $_POST['string'];
Problem comes in with the ssh2 function ssh2_exec syntax. I want to execute 'mkdir <string>' on the remote server. I have the basic SSH auth (with key) so I just need to know how to define the command.
is the normal syntax, but how would I add the $string to it?ssh2_exec($connection, 'command');
does not work.ssh2_exec($connection, 'mkdir ', $string);
I am very new to programming and this is just because I like playing around with it, I know PHP isn't the best option, so please just try and assist me with this.
Thanks