title: Using FTP from PHP CURL
body: <p>I can't figure out how to use CURL's FTP, specifically, how to issue FTP commands from my PHP code:</p>
  
  <pre><code>&lt;?php
      $ch = curl_init();
      curl_setopt($ch, CURLOPT_URL, 'ftp://ftp.microsoft.com/');
      curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
  
      curl_setopt($ch,CURLOPT_POSTQUOTE,array('CWD bussys/','LIST')); /* ?!! */
  
      echo '&lt;hr&gt;&lt;pre&gt;'.htmlspecialchars(curl_exec($ch)).'&lt;/pre&gt;&lt;hr&gt;';
  ?&gt;
  </code></pre>
  
  <p>In my example above I want to get a directory listing of bussys, but instead I get a listing of the main (FTP root) directory.</p>
  
  <p>By the way, I tried the following combinations:</p>
  
  <ul>
  <li><code>LIST bussys/</code></li>
  <li><code>CWD bussys, LIST -a</code></li>
  </ul>