Capture error returned in api php

No response as catch errors when sending a command through php api.

in delphi do so:

 if Res.Trap then
      mem.Lines.Add('Trap: ' + ROS.LastError)

in php is not as

<?php

//require('routeros_api.class.php');
require './routeros_api.class';

$API = new routeros_api();

$API->debug = true;

if ($API->connect('192.168.1.1', 'admin', '123')) {

  $API->comm("/ppp/secret/add", array(
          "name"     => "user",
          "password" => "pass",
          "remote-address" => "172.16.1.10",
          "comment"  => "{new VPN user}",
          "service"  => "pptp",
));
  
 // this is where I want to capture if an error occurs
  //example delphi
  if Res.Trap then
      echo="Error ".ROS.LastError)
  
  
   $API->disconnect();

}

?>

I just want a response from the fault name.

excuse my English, I use google translator

first you need to say what PHP implementation of RouterOS API you’re using :wink:

Didn’t I answer this question already, though for another username? It sounds too convenient that both of you would use the exact same code examples, unless maybe you’re the same person OR know “tara” personally.