curl-and-php
Re: delete file from ftp with quote
Date: Fri, 25 Jul 2008 17:06:33 +0200
Hi Stephen, thanks for your reply.
I changed my code as you suggested, but the option CURLOPT_USERPWD is
skipped... curl tries to do anonymous login and ftp server denies
access.
With my previous code and option CURLOPT_RETURNTRANSFER to 0 is
returned the listing of directory out... :/
2008/7/25 Stephen Pynenburg <spynenburg_at_gmail.com>:
> Hi,
>
> I'm sure that the form user:pass_at_host.com works in the command line and in
> browsers, but I'm not so sure that it works in PHP. Try using
>
> curl_setopt($ch, CURLOPT_USERPWD, "user:pass");
>
> Try setting RETURNTRANSFER to 0 while you're testing, so you can see how the
> actual result is coming out. Let me know how it goes :)
>
> -Stephen
>
> On Fri, Jul 25, 2008 at 9:01 AM, Gaetano Favoino <gaetano.favoino_at_gmail.com>
> wrote:
>>
>> Hi guys,
>> I'm really going crazy trying to delete a file on an ftp server using
>> quote command.
>>
>> It seems that the quote command is not sent by curl, it seems to be
>> skipped.
>> From the console I launched the following command
>> curl --quote "-dele FNVAC20080716140014.CHK" ftp://<usr>:<psw>@<host>/OUT
>> and everything is ok, but when the call is done by php it doesn't
>> delete the file, and the log file has no information about the quote.
>>
>> Here's my code
>> $comandi_array = array();
>> $comandi_array[] = "\"-dele FNVAC20080716140014.CHK\"";
>> /*
>> I've tried also the followings
>> $comandi_array[] = "-dele FNVAC20080716140014.CHK";
>> $comandi_array[] = "dele FNVAC20080716140014.CHK";
>> $comandi_array[] = "dele \"FNVAC20080716140014.CHK\"";
>> $comandi_array[] = "-dele \"FNVAC20080716140014.CHK\"";
>> but problem has not been solved
>> */
>> $ftp_url = "ftp://".$username.":".$password."@".$host."/OUT/";
>> $error_FH = fopen("error.log","w");
>> $ch = curl_init();
>> curl_setopt($ch, CURLOPT_VERBOSE, 1);
>> curl_setopt($ch, CURLOPT_FTPLISTONLY, 1);
>> curl_setopt($ch, CURLOPT_URL, $ftp_url);
>> curl_setopt($ch, CURLOPT_QUOTE, $comandi_array);
>> curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
>> curl_setopt($ch, CURLOPT_STDERR, $error_FH);
>> if (strlen($proxy_server)) curl_setopt ($ch, CURLOPT_PROXY,
>> $proxy_server);
>> curl_setopt ($ch, CURLOPT_TIMEOUT, 360);
>> $res = curl_exec ($ch);
>> $err = curl_errno( $ch );
>> $errmsg = curl_error( $ch );
>> curl_close ($ch);
>> fclose($error_FH);
>>
>> No errors and warnings on this code :( any suggestion?
>>
>> --
>> Gaetano Favoino
>> gaetano.favoino_at_gmail.com
>> PGP-FP E97A 062D 359A 5B09 FFE9 4842 EDEF EEF6 4AA3 CAEC
>> :wq
>> _______________________________________________
>> http://cool.haxx.se/cgi-bin/mailman/listinfo/curl-and-php
>
>
> _______________________________________________
> http://cool.haxx.se/cgi-bin/mailman/listinfo/curl-and-php
>
>
-- Gaetano Favoino gaetano.favoino_at_gmail.com PGP-FP E97A 062D 359A 5B09 FFE9 4842 EDEF EEF6 4AA3 CAEC :wq _______________________________________________ http://cool.haxx.se/cgi-bin/mailman/listinfo/curl-and-phpReceived on 2008-07-25