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

curl-and-php

CURLOPT_FTP_FILEMETHOD from php?

From: Alan Pinstein <apinstein_at_showcasere.com>
Date: Wed, 22 Nov 2006 09:41:01 -0600

[ I sent this last night, but it never seemed to come through, so I
am re-sending. Apologies if it's a dupe ]

I have a need to use CURLOPT_FTP_FILEMETHOD in a script.

However, the php-curl integration doesn't define this option.

I looked in the curl headers and came up with:

                 $ch = curl_init();
                 curl_setopt($ch, CURLOPT_URL, $url);
                 curl_setopt($ch, CURLOPT_FTP_USE_EPSV, false);
                 curl_setopt($ch, CURLOPT_HEADER, false);
                 curl_setopt($ch, CURLOPT_FAILONERROR, true);
                 curl_setopt($ch, CURLOPT_BINARYTRANSFER, true);
** curl_setopt($ch, 138 /* CURLOPT_FTP_FILEMETHOD */, 3 /
* CURLFTPMETHOD_SINGLECWD */);
                 $localFH = fopen($localCopyPath, 'w+');
                 if ($localFH)
                 {
                     curl_setopt($ch, CURLOPT_FILE, $localFH);
                     $ok = curl_exec($ch);
                     fclose($localFH);
                 }
                 else
                 {
                     $ok = false;
                 }
                 curl_close($ch);

However, it doesn't work... it still tries to CD one dir at a time.

I am using:
cURL Information => libcurl/7.15.5 OpenSSL/0.9.8d zlib/1.2.3

It does work with "curl --ftp-method singlecwd" though....

Any thoughts?

Thanks,
Alan
_______________________________________________
http://cool.haxx.se/cgi-bin/mailman/listinfo/curl-and-php
Received on 2006-11-22