doswy02440
2019-02-14 09:46
浏览 501
已采纳

如何从ftp服务器获取文件并在自己的服务器上复制

I want to get file from client server and copy them on my server , I have successfully connected to client server, my code is below.

// connect and login to FTP server
$ftp_server = "xx.xxx.xxx.xxx";
$ftp_username = 'xxxxxxxxxxxxxxx';
$ftp_userpass = 'xxxxxxxxxxxxxxxx';
 $ftp_conn = ftp_connect($ftp_server) or die("Could not connect to $ftp_server");
$login = ftp_login($ftp_conn, $ftp_username, $ftp_userpass);
echo "<pre>";
 print_r($login);
  echo "</pre>";
 // get the file list for /
 $filelist = ftp_rawlist($ftp_conn, "/");

// close connection
ftp_close($ftp_conn);
echo "<pre>";
print_r($filelist);
echo "</pre>";
// output $filelist
var_dump($filelist);

May anyone please advise how can I achieve this?

2条回答 默认 最新

相关推荐 更多相似问题