PHP FTP transfer
I have files that are automatically uploaded onto a server from mobile phones, and I nee开发者_StackOverflow中文版d to automatically transfer these files from the server to another server using PHP.
Could someone please explain how I would do this?
Thanks for any help
PHP has FTP functionality built in with FTP wrappers:
Allows read access to existing files and creation of new files via FTP. If the server does not support passive mode ftp, the connection will fail.
This means you can use FTP like any other file - an extremely simple example:
<?php
$data = file_get_contents('some/other/file.txt');
$fname = "ftp://name:yourpassword@127.55.41.10:21/some/path/filename.txt";
file_put_contents($fname,$data);
?>
精彩评论