title: how to execute a command telnet php
body: <p>I have a code to connect to a teamspeak server with telnet.
  can someone help me sending a command?</p>
  
  <p>my code:</p>
  
  <pre><code>&lt;?php
  $ip = 'localhost';
  $result = '';
  $fp = fsockopen($ip, 10011); 
  echo fgets($fp); 
        fputs($fp,"help");
        $result=fread($fp,1024); 
  fclose($fp);
  echo nl2br($result);
  ?&gt;
  </code></pre>
  
  <p>I want to send the command "help"</p>
  
  <p>this code only returns:</p>
  
  <pre><code>TS3 
  Welcome to the TeamSpeak 3 ServerQuery interface, type "help" for a list of commands and "help " for information on a specific command.
  </code></pre>