Re: cURL FTP

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Dec 15, 2004, at 8:47 AM, Ian Firla wrote:

On Wed, 2004-12-15 at 08:27 -0500, Lowell Allen wrote:

I'm trying to FTP a text file from a commercial hosting server, but the file isn't being transferred and I'm not getting any feedback from the script. Here's the code:

[snip]

$c = curl_init("ftp:// $username:$password@ftp.$remote_domain.$remote_file_location");
$fh = fopen("test.txt", "r") or die($php_errormsg);
curl_setopt($c, CURL_UPLOAD, TRUE);
curl_setopt($c, CURL_TRANSFERTEXT, TRUE);
curl_setopt($c, CURL_INFILE, $fh);
curl_setopt($c, CURL_RETURNTRANSFER, TRUE);
$result = curl_exec($c);
curl_close($c);
echo("<p>".$result."</p>\n");

[snip]

Try opening the file "rw". At the moment, you're opening it read only.

Thanks for the reply, but I'm opening test.txt as the local file for uploading. I don't need to write to it. (I tried it anyway, same result -- no result.)


I've switched to ftp_put() and ftp_fput() and will start a new thread with a different subject line.

--
Lowell Allen

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux