Writing a wrapper class for cURL/FTP in PHP. When I get or put files etc. standard ops with specific cURL options, cURL doesn't return the FTP directory index as the default response.
However: When I run custom FTP commands with CURLOPT_CUSTOMREQUEST
, CURLOPT_QUOTE
or CURLOPT_POSTQUOTE
, for example to DELE
or RNFR|RNTO
, the FTP server returns the directory index as the default response in addition to running the commands. (If the commands are successful.)
This'd be expected behavior since CURLOPT_URL
is also passed in, and without upload/download the index is what you get. (And I can't connect to the server w/o using CURLOPT_URL
, or can I?) But I really don't care to waste bandwidth/RAM for receiving the index for every command I run. Would be problematic with large directories or large amounts of individual commands.
Of course I could minimize the waste by bundling up all the ops into a single curl_exec()
call. I can minimize the response by adding in a CURLOPT_FTPLISTONLY
, but that's still a load of unnecessary data being returned. Or I could append a failing command, very hackish and gives me just a fail result although the cmds are done. Or I could finally CWD into a directory that I know is blank huh? {^_^}
Then: Is there a way to tell cURL not to bother returning the directory index? Implementing a request pooler for cURL FTP calls coming in from various times/locations in other code using the class would also prevent me from returning individual success/fail responses in real time.