altariamx2003
asked on
How to delete files storage using curl and php
I need to delete files in my ftp server, before I tried with ftp_server but It doesnt works.
Thats way I change to curl to delete the files and It works, this is the code:
but allways show me the following message:
-------------------------- ---------- ---------- ---------- ---------- ---------- ---------- ---------- ---------- ---------- ---
drwx--x--x 12 user user 4096 Aug 20 23:20 . drwx--x--x 12 user user 4096 Aug 20 23:20 .. -rw-r--r-- 1 user user 24 Sep 22 2008 .file -rw-r--r-- 1 user user 191 Sep 22 2008 .file -rw-r--r-- 1 user user 124 Sep 22 2008 .file -rw-r--r-- 1 user user 5619 Sep 22 2008 .file -rw------- 1 user user 27 Sep 22 2008 .file drwx------ 5 user user 4096 Aug 19 14:00 .file -rw-r--r-- 1 user user 383 Sep 22 2008 .file -rw------- 1 user user 15 Aug 20 04:45 .file drwxr-x--- 2 user 99 4096 Sep 22 2008 .file -rw------- 1 user user 12 Aug 20 23:20 .file -rw-r--r-- 1 user user 658 Sep 22 2008 .file drwxr-xr-x 2 user user 4096 Jun 23 13:05 _Scripts lrwxrwxrwx 1 user user 33 Sep 22 2008 others -> /path drwxr-xr-x 3 user 12 4096 Aug 19 13:40 other drwxrwx--- 6 user user 4096 Aug 19 14:00 other drwxr-xr-x 17 user user 4096 Aug 17 16:03 data drwxr-xr-x 3 user user 4096 Sep 12 2008 other drwxr-x--- 23 user 99 4096 Aug 20 11:15 other drwxr-xr-x 2 user user 4096 Aug 19 13:40 other drwxr-xr-x 23 user user 4096 Aug 19 14:00 other lrwxrwxrwx 1 user user 11 Sep 22 2008 other-> other
-------------------------- ---------- ---------- ---------- ---------- ---------- ---------- ---------- ---------- ---------
I would like to know how to disable that message
Thats way I change to curl to delete the files and It works, this is the code:
$ftpurl = "ftp://user:password@ftp.server";
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $ftpurl);
curl_setopt($ch, CURLOPT_QUOTE, array("DELE /path/".$archivo));
curl_exec($ch);
$error = curl_errno($ch);
curl_close ($ch);
if ($error == 0)
{ $flag == true; }
else
{ $flag == false; }
but allways show me the following message:
--------------------------
drwx--x--x 12 user user 4096 Aug 20 23:20 . drwx--x--x 12 user user 4096 Aug 20 23:20 .. -rw-r--r-- 1 user user 24 Sep 22 2008 .file -rw-r--r-- 1 user user 191 Sep 22 2008 .file -rw-r--r-- 1 user user 124 Sep 22 2008 .file -rw-r--r-- 1 user user 5619 Sep 22 2008 .file -rw------- 1 user user 27 Sep 22 2008 .file drwx------ 5 user user 4096 Aug 19 14:00 .file -rw-r--r-- 1 user user 383 Sep 22 2008 .file -rw------- 1 user user 15 Aug 20 04:45 .file drwxr-x--- 2 user 99 4096 Sep 22 2008 .file -rw------- 1 user user 12 Aug 20 23:20 .file -rw-r--r-- 1 user user 658 Sep 22 2008 .file drwxr-xr-x 2 user user 4096 Jun 23 13:05 _Scripts lrwxrwxrwx 1 user user 33 Sep 22 2008 others -> /path drwxr-xr-x 3 user 12 4096 Aug 19 13:40 other drwxrwx--- 6 user user 4096 Aug 19 14:00 other drwxr-xr-x 17 user user 4096 Aug 17 16:03 data drwxr-xr-x 3 user user 4096 Sep 12 2008 other drwxr-x--- 23 user 99 4096 Aug 20 11:15 other drwxr-xr-x 2 user user 4096 Aug 19 13:40 other drwxr-xr-x 23 user user 4096 Aug 19 14:00 other lrwxrwxrwx 1 user user 11 Sep 22 2008 other-> other
--------------------------
I would like to know how to disable that message
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Instead, you can use ob_start() to capture the message in the output buffer. Then if the curl_errno() shows that an error occurred, you can use ob_get_contents() to retrieve the output buffer with the message in it. If curl_errno() shows no errors, you can use ob_end_clean() to discard the output buffer.
The output buffer functions are documented on the PHP man pages, linked here:
http://us3.php.net/manual/en/function.ob-start.php
Best regards, ~Ray