-1

I'm having another problem with the quotes in PHP, I have two sets of nested quotes inside a normal set and this is what I thought should work

 if (!($stream = ssh2_exec($con, 'screen -p 0 -S new3 -X eval \"stuff \"stop\"\015\"'))) {

This is how it is in just a simple bash script:

screen -p 0 -S minecraft -X eval 'stuff \"stop\"\015'

So I need help getting it from bash to working in PHP, thanks!

Ry-
  • 218,210
  • 55
  • 464
  • 476
Jeremy Sayers
  • 637
  • 4
  • 10
  • 23

1 Answers1

1

you need to escape the escape character, like so:

if (!($stream = ssh2_exec($con, 'screen -p 0 -S minecraft -X eval \'stuff \\"stop\\"\\015\''))) {

too many quoting though, and you get the leaning toothpick problem.

Lie Ryan
  • 62,238
  • 13
  • 100
  • 144
  • Ahh! So close, it is sending the command to the minecraft session but it is sending "stop" (WITH quotes) instead of just stop (WIHTOUT quotes) lol, what could be the cause for that? – Jeremy Sayers Apr 21 '12 at 02:35