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

curl-and-php

delete file from ftp with quote

From: Gaetano Favoino <gaetano.favoino_at_gmail.com>
Date: Fri, 25 Jul 2008 15:01:08 +0200

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
Received on 2008-07-25