Creating a file on another server using PHP file functions

I have a script on my one server and I want the script to create a file on another server using PHP and not VIA FTP?

+5
source share
4 answers

There are many ways to do this. I would choose the first one myself, because it is easiest to configure:

  • If you have PHP + Apache on another server, just call the script on another server using file_get_contents with the http URL as the file name or use cURL if you need the contents of the POST file as well.
  • (LAN, VPN), Windows/ Samba NFS, ​​ fopen/fwrite
  • SSH SCP SFTP
+2

PHP SSH - . ssh2 *, ssh2_scp_send ssh2_scp_recv.

, Linux, SMB Windows.

+1

, FTP ( PHP) .

, , , , :

PHP, , PHP script , POST . - , POST.

0

You can always use DAV , but some configuration on the receiving server may be required. There is also SSHFS , which makes it easy to mount the remote directory locally through the SSH tunnel, or simply use the ssh2_ * family of functions as Andy Shellam suggested .

Indeed, there are many ways to do this.

0
source

All Articles