Connected User on mikrotik

Hi, I would like to know how I can do to retrieve information from a device once it connects to the network. With the php API preferred.
thank you in advance