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

curl-and-php

Moving files on an FTP server via libcurl

From: Vipin hegde <vipinhegde_at_gmail.com>
Date: Wed, 27 Jun 2007 11:27:33 -0700

I'm trying to connect upto a secure FTP site (using PHP + libcurl) which has
the following folder structure:

/datafiles
    /old_datafiles

I can connect to the server, but all the approaches I've tried to move the
files which reside in the "datafiles" folder over to the "old_datafiles"
subfolder, have failed. Here's the code i have so far:

  $cobj = curl_init();
  curl_setopt($cobj, CURLOPT_URL, $ftp_url);
  curl_setopt($cobj, CURLOPT_RETURNTRANSFER,1);
  curl_setopt($cobj, CURLOPT_VERBOSE, 1);
  curl_setopt($cobj, CURLOPT_USERPWD, $username . ":" . $password);
  curl_setopt($cobj, CURLOPT_FTP_USE_EPSV, 0);
  curl_setopt($cobj, CURLOPT_FTP_USE_EPRT, 0);
  curl_setopt($cobj, CURLOPT_FTP_SSL, CURLFTPSSL_ALL);
  curl_setopt($cobj, CURLOPT_SSL_VERIFYPEER, 0);
  curl_setopt($cobj, CURLOPT_SSL_VERIFYHOST, 0);
  curl_setopt($cobj, CUROPT_POSTQUOTE, array("RENAME $filename TO
old_datafiles/$filename"));

Any help in finding a solution would be greatly appreciated !

-- 
Regards,
Vipin

_______________________________________________
http://cool.haxx.se/cgi-bin/mailman/listinfo/curl-and-php
Received on 2007-06-27