title: How do I use fsockopen() to open a Telnet connection with a password?
body: <p>I'd like to access a camera through it's Telnet capability. The problem is, it has Password-protection. This is no problem when doing it via Terminal, as I just use <code>telnet 10.30.blah.blah</code> then enter my password when prompted. But in php, I don't see the opportunity to input a password.</p>
  
  <pre><code>$con = fsockopen("10.30.blah.blah", 25);
  $msg = "camera move left";
  fwrite($con, $msg);
  </code></pre>
  
  <p>Anybody have any ideas?</p>
  
  <p><strong>UPDATE</strong>: I tried just using fputs to output the password as @Cfreak said, but still to no avail. If I do exactly what the script is trying in terminal, it works. Here's the code now:</p>
  
  <pre><code>$con = fsockopen("10.30.blah.blah", 23, $errno, $errstr, 30);
  $pass = "admin";
  sleep(5);
  fputs($con, $pass);
  sleep(5);
  $msg = "camera move left";
  fputs($con, $msg);
  </code></pre>
  
  <p><strong>UPDATE</strong>: Found that I needed a <code>\r</code> at the end of my <code>$msg</code> variable. Thanks for the help!</p>