Re: cURL FTP

From: Date: Wed, 15 Dec 2004 16:38:13 +0000
Subject: Re: cURL FTP
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-204408@lists.php.net to get a copy of this message
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

« previous php.general (#204408) next »