I need some help with escaping the quotes in this script, I have code above and below, but it does not pertain to this because if I just issue a screen -d -m -S minecraft, it creates one fine. Any help would be amazing because i've been trying for an hour now, Thanks!
if (!($stream = ssh2_exec($con, 'screen -d -m -S minecraft -p 0 -X stuff "\printf "\say This is a test.\r"\"\' ))) {
echo "fail: unable to execute command\n";
} else {
// collect returning data from command
stream_set_blocking($stream, true);
$data = "";
while ($buf = fread($stream,4096)) {
$data .= $buf;
}
echo $data;
fclose($stream);
}
Shouldn't the \
should go before the "
. Also, from your description, it sounds like that you only want to run "screen -d -m -S minecraft" and it looks like you have an extra printf in there.
if (!($stream = ssh2_exec($con, "screen -d -m -S minecraft")))