cURL FTP

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

 



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:

$username = "whatever";
$password = "somepassword";
$remote_domain = "somedomain.com";
$remote_file_location = "/upload/testtransfer.txt";

$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");


Running this produces nothing -- $result has no value and no file is transferred. cURL is available on the server I'm sending from because I use it successfully for a couple scripts. The "upload" directory has permissions set to 777. The server I'm attempting to upload to runs in a shared hosting environment. I've read what I think are the relevant sections of the manual.

I'd appreciate info or links to info on setting up cURL to do an FTP transfer and return the success or failure of the operation. Thanks.

--
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