don't forget also that PHP can (depending on your server permissions of course) simple execute (via system(), exec(), or `` backtics) the direct telnet command.
exec("telnet to.somewhere.com");
that's not interactive though, it would only let you check the output, for instance to see if the server responded correctly.
BUT, using linux and |, you could do:
exec("echo 'sh proc cpu' | telnet to.somewhere.com");
to execute a single command.