0

ftp 経由で 1 つのサーバーに接続し、zip ファイルをダウンロードする必要があります。

これは私が運なしで試したことです:

$url = $server_file = '/expiring_service_auctions.csv.zip';
$target = $local_file = 'godaddy.zip';
$out = 'godaddy.csv';


$ftp_server = 'ftp.godaddy.com'; //'208.109.78.100'
$ftp_user_name = 'auctions';
$ftp_user_pass = ''; //no pass


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

// login with username and password
$login_result = ftp_login($conn_id, $ftp_user_name, $ftp_user_pass);

// get contents of the current directory
$contents = ftp_nlist($conn_id, ".");

// output $contents
var_dump($contents);

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

何をすべきか?何をすべきか?

4

1 に答える 1