Capture php api error
I am trying to capture the errors returned in api php … for example if a user already exists
<?php
//require('routeros_api.class.php');
require './routeros_api.class';
$API = new routeros_api();
$API->debug = false;
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();
} else echo "Error al conectar a MK"
?>
I do it in delphi follows
// this is where I want to capture if an error occurs
//example delphi
if Res.Trap then
echo "Error ".ROS.LastError
regards