Php 从直接链接远程上载

Php 从直接链接远程上载,php,file-upload,remote-server,Php,File Upload,Remote Server,我有一个从服务器1直接链接的大文件 http://xx.com/linux1.iso (3 gb) 我需要用php上传到我的第二个服务器(我没有一个好的adsl,我有更多的大文件,只有一周的时间来移动所有网站) 可以在服务器2上创建一个php脚本,通过直接链接将文件从中的服务器1复制到服务器2?如果您有ssh访问权,可以下载文件登录到ssh会话,并使用带有wget的链接下载文件(如果服务器上的操作系统是linux) 通过php使用file\u put\u contents和file\u get

我有一个从服务器1直接链接的大文件

http://xx.com/linux1.iso (3 gb)
我需要用php上传到我的第二个服务器(我没有一个好的adsl,我有更多的大文件,只有一周的时间来移动所有网站)


可以在服务器2上创建一个php脚本,通过直接链接将文件从中的服务器1复制到服务器2?

如果您有ssh访问权,可以下载文件登录到ssh会话,并使用带有
wget
的链接下载文件(如果服务器上的操作系统是linux)

通过php使用
file\u put\u contents
file\u get\u contents

<?php
set_time_limit(0); //makes it so script doesnt timeout after the default 30 seconds
//downloads the file then saves it to path
file_put_contents("/path/to/download/to/file.iso",file_get_contents("http://mylink.com/file.iso"));

或者如果您使用的是SSH,那么就不需要PHP。只需使用命令

scp your_username@server1:linux1.iso /some/local/directory/on/server2