cURL / Mailing Lists / curl-and-php / Single Mail

curl-and-php

Re: delete file from ftp with quote

From: Stephen Pynenburg <spynenburg_at_gmail.com>
Date: Fri, 25 Jul 2008 10:14:27 -0400

Hi,

I'm sure that the form user:pass_at_host.com <user%3Apass_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
Received on 2008-07-25