The question isn't about PHP but about using a web application.
You can use PHP to do the socket connection and monitoring, e-mailing, SMS, placing orders, receiving execution reports etc. ALL outside of the web server in a process that's running continuously outside of the web server so you...