views:

146

answers:

0

I can't figure out how to use CURL's FTP, specifically, how to issue FTP commands from my PHP code:

<?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 '<hr><pre>'.htmlspecialchars(curl_exec($ch)).'</pre><hr>';
?>

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.

By the way, I tried the following combinations:

  • LIST bussys/
  • CWD bussys, LIST -a