First, your approach:
1.) Telnet behavior: your socket_read may not return false or reach the maximum 2048 bytes, so you have an infinite loop, however since you are able to socket_write, the command succeeds. On the other hand, calling quit() may close the socket prematurely, resulting to failed socket writes, failed commands.
The suggested approach:
1.) We suggest using the Runtime APIs for this documented here: https://evostream.com/support/documenta … -time-api/
2.) We have included in the installation package a web application written in PHP that does exactly or is similar to what you want to achieve. Look for EMS_Web_UI folder located under the evo-webroot.