在php中连接到同一网络上的另一台计算机

时间:2014-12-15 07:45:10

标签: php

我必须连接到另一台计算机并下载文件并通过PHP将其提取到同一网络上的计算机。我怎样才能做到这一点?请帮助。

2 个答案:

答案 0 :(得分:2)

您可以使用:

$url = 'http://192.168.1.1/test.html';
$file = 'test.html';
file_put_contents($file, file_get_contents($url));

答案 1 :(得分:1)

使用PHP FTP http://php.net/manual/en/book.ftp.php

或CURL。

http://php.net/manual/en/book.curl.php

或者你可以在shell_exec中执行wget