Comma - Error in terminal send " "

Hi guys,

I´m From brazil.

I have a PHP script in PHP, above, one line:

passthru("$sshpass -p $srv_mkt_pwd ssh sagu-pro@$srv_mkt_ip "/ip address print without-paging ; /ip address remove ‘$ips’ " ");

This is a part of script, the variable ‘$ips’ is the name of the ARP, example 105-Markux-James

This line send to mikrotik:

/ip address remove 105-Markux-James

But, the caracter - in the line, is going RED and mikrotik show a error

[admin@SVNET] > /ip arp remove 105-
expected end of command (line 1 column 20)

The only way is type:

/ip address remove “105-Markux-James”

In PHP i dont now how to send " " inside de line. If i do, the PHP show a ERROR.

The Mikrotik is version 3.23

thnks in advance

I think, you should double-escape the string, like

passthru("$sshpass -p $srv_mkt_pwd ssh sagu-pro@$srv_mkt_ip "/ip address print without-paging ; /ip address remove \"$ips\" " ");

Hi. my english is poor !!

your answer is right. worked in parts

Look the other part of the script in php

After SQL select, the script runs, and write a temp file

$teste=shell_exec(“$sshpass -p $srv_mkt_pwd ssh sagu-pro@$srv_mkt_ip /ip arp print without-paging | grep ‘;;; $id_pessoa-’ > $file”);
$handle = fopen($file,‘r’);
while ($linha = fgets($handle,1024)){
//echo “Deletar “.$linha.”
”;
$array_ips=explode(“;;; “,$linha);
$ipsx=$array_ips[1];
$ips=substr_replace($ipsx ,””,-2); /// <<<<< added to remove 2 last caracters !!!
#GATEWAY CASO DO /30
passthru("$sshpass -p $srv_mkt_pwd ssh sagu-pro@$srv_mkt_ip "/ip address print without-paging ; /ip address remove \"$ips\" " ");

You see, the result of the ARP LIST, where de name of ARP match de $id_pessoa, the GREP write in a file, temp.

Ok, but, in the file, the line have a /r (i debug in mk console) then, the script send to mikrotik the variable:

22:28:52 script,info 66-Thiago-Cardoso-Pepe\r

Look the “/r” in the end.

Not work.

If you see in the script, i added a $ips=substr_replace($ipsx ,“”,-2); to remove the last 2 caracters in the line, including the line-break (/r)

Now, all working, the mikrotik receive:
22:38:52 script,info 66-Thiago-Cardoso-Pepe

and all script runs ok.

Your reply was crucial to the solution of my problem.

THANKS DUDE !!!

glad to hear it =)