[FX.php List] [off] Writing PHP script for downloading

Bob Patin bob at patin.com
Sun Jan 8 14:35:20 MST 2012


I'm trying to write a script to download from specific directories on my servers; here's basically what I'm trying


// define vars
$local_file = 'test.pdf';
$server_file = $local_file;

$server = 'xs3.longtermsolutions.com';
$un = 'bobtest';
$pw = 'b0bt3st';

// set up basic connection
$conn_id = ftp_connect($server);

// login with username and password
$login_result = ftp_login($conn_id, $un, $pw);

// turn passive mode on
ftp_pasv($conn_id, false);

// try to download $server_file and save to $local_file
if (ftp_get($conn_id, $local_file, $server_file, FTP_BINARY)) {
   echo "Successfully written to $local_file\n";
} else {
   echo "There was a problem\n";
}

// close the connection
ftp_close($conn_id);



What am I missing here? If you go to

http://www.longtermsolutions.com/ftp_test.php

you'll see that it fails...

Thanks for any help,

Bob Patin
Longterm Solutions LLC
P.O. Box 3408
Brentwood, TN 37024
bob at longtermsolutions.com
615-333-6858
http://www.longtermsolutions.com
iChat: bobpatin
AIM: longterm1954
Twitter: bobpatin
Google+: http://www.longtermsolutions.com/plus
--
FileMaker 9, 10 & 11 Certified Developer
Member of FileMaker Business Alliance and FileMaker TechNet
--
FileMaker hosting and consulting for all versions of FileMaker
PHP • Full email services • Free DNS hosting • Colocation • Consulting



More information about the FX.php_List mailing list