I made that bot ages ago just to prove you could make a bot in PHP that could keep the connection alive for a substantial amount of time and not have the script timeout. The bot uses both AJAX and live PHP output. The AJAX kicks in when you type and hit enter which thus sends the text to a script that puts it in a queue to go to bnet. When you load the webbot view script it creates a socket which connects to the backend script and echo's then flushes text as it comes in. A more efficient way would be to set the PHP INI setting that turns on flushing after every output, can't think of it off the top of my head, but I didn't know about this setting when I coded the bot. Also, I think my debugging code should still be built in which creates a hex and string representation of all the packets as they go in and out. Just uncomment the debugging lines.