API Tellnet Callback

I need to know, if the API have a callback or a “trick” to this routine, each time I run a script i need to know if the task was completed with sucess or not.

E.g:
“$mk->routeros_cmd(‘/ip hotspot user profile add name=john address-pool=hs-pool-2 rate-limit=512k/512k’);”
My script only can continue if that user was created.

you understood?

thanks everyone

That is why you have to use our API instead.
It will return if command failed or succeeded.
More info:
http://wiki.mikrotik.com/wiki/Manual:API

Thanks for reply.
After I created this topic, I read about of native API.

i’m using like that:

(...)
$array = $api->read();
   	
   if(array_key_exists('!trap',$array))
   {
   	echo 'Opss. Error.';
   } 
    else
    {
        echo 'OK, continue...';
    }

There a better way?